From 59604b9474e2e640875037c5944e34e4f6b9bc19 Mon Sep 17 00:00:00 2001 From: jiyong_sd Date: Tue, 19 Jul 2022 16:59:53 +0800 Subject: [PATCH] modified FA-JSF Signed-off-by: jiyong_sd Change-Id: I979a3d5c05102542d15b36c075495e1760b7b03e --- .../netmanager_base/dns/BUILD.gn | 12 +- .../netmanager_base/dns/Test.json | 38 +- .../js/resources/base/element/string.json | 12 - .../main/resources/base/element/string.json | 12 - .../dns/{entry => }/src/main/config.json | 245 +- .../main/js/MainAbility}/app.js | 46 +- .../src/main/js/MainAbility}/i18n/en-US.json | 14 +- .../src/main/js/MainAbility}/i18n/zh-CN.json | 14 +- .../js/MainAbility}/pages/index/index.css | 18 +- .../js/MainAbility}/pages/index/index.hml | 10 +- .../main/js/MainAbility}/pages/index/index.js | 91 +- .../dns/src/main/js/TestAbility/app.js | 23 + .../src/main/js/TestAbility}/i18n/en-US.json | 14 +- .../src/main/js/TestAbility}/i18n/zh-CN.json | 14 +- .../js/TestAbility}/pages/index/index.css | 58 +- .../js/TestAbility}/pages/index/index.hml | 10 +- .../main/js/TestAbility/pages/index/index.js | 26 + .../js/TestRunner/OpenHarmonyTestRunner.js | 59 + .../src/main/js}/test/List.test.js | 36 +- .../main/js/test/NetworkManagerDNS.test.js | 322 +- .../main/resources/base/element/string.json | 28 + .../main}/resources/base/media/icon.png | Bin .../network_nopermission/BUILD.gn | 12 +- .../network_nopermission/Test.json | 38 +- .../js/resources/base/element/string.json | 16 - .../main/resources/base/element/string.json | 16 - .../{entry => }/src/main/config.json | 155 +- .../src/main/js/MainAbility}/app.js | 44 +- .../src/main/js/MainAbility}/i18n/en-US.json | 14 +- .../src/main/js/MainAbility}/i18n/zh-CN.json | 14 +- .../js/MainAbility}/pages/index/index.css | 58 +- .../js/MainAbility}/pages/index/index.hml | 10 +- .../main/js/MainAbility}/pages/index/index.js | 91 +- .../src/main/js/TestAbility/app.js | 23 + .../src/main/js/TestAbility}/i18n/en-US.json | 14 +- .../src/main/js/TestAbility}/i18n/zh-CN.json | 14 +- .../main/js/TestAbility/pages/index/index.css | 30 + .../main/js/TestAbility/pages/index/index.hml | 5 + .../main/js/TestAbility/pages/index/index.js | 26 + .../js/TestRunner/OpenHarmonyTestRunner.js | 59 + .../main/js/test/Http.nopermission.test.js | 220 +- .../src/main/js/test/List.test.js | 37 +- .../main/resources/base/element/string.json | 24 + .../src/main/resources/base/media/icon.png | Bin .../netmanager_base/register/BUILD.gn | 12 +- .../netmanager_base/register/Test.json | 38 +- .../js/resources/base/element/string.json | 12 - .../src/main/js/resources/base/media/icon.png | Bin 6790 -> 0 bytes .../entry/src/main/js/test/List.test.js | 17 - .../js/test/NetworkManagerRegister.test.js | 2512 --------- .../main/resources/base/element/string.json | 12 - .../src/main/resources/base/media/icon.png | Bin 6790 -> 0 bytes .../register/{entry => }/src/main/config.json | 245 +- .../main/js/MainAbility}/app.js | 46 +- .../src/main/js/MainAbility/i18n/en-US.json | 8 + .../src/main/js/MainAbility/i18n/zh-CN.json | 8 + .../js/MainAbility}/pages/index/index.css | 18 +- .../js/MainAbility}/pages/index/index.hml | 10 +- .../main/js/MainAbility}/pages/index/index.js | 91 +- .../register/src/main/js/TestAbility/app.js | 23 + .../src/main/js/TestAbility/i18n/en-US.json | 8 + .../src/main/js/TestAbility/i18n/zh-CN.json | 8 + .../main/js/TestAbility/pages/index/index.css | 30 + .../main/js/TestAbility/pages/index/index.hml | 5 + .../main/js/TestAbility/pages/index/index.js | 26 + .../js/TestRunner/OpenHarmonyTestRunner.js | 59 + .../src/main/js/test/List.test.js | 36 +- .../js}/test/NetworkManagerRegister.test.js | 5017 +++++++++-------- .../main/resources/base/element/string.json | 28 + .../src/main}/resources/base/media/icon.png | Bin .../netmanager_base/system_fetch/BUILD.gn | 12 +- .../netmanager_base/system_fetch/Test.json | 38 +- .../js/resources/base/element/string.json | 16 - .../src/main/js/resources/base/media/icon.png | Bin 6790 -> 0 bytes .../main/resources/base/element/string.json | 16 - .../src/main/resources/base/media/icon.png | Bin 6790 -> 0 bytes .../{entry => }/src/main/config.json | 159 +- .../src/main/js/MainAbility}/app.js | 44 +- .../src/main/js/MainAbility/i18n/en-US.json | 8 + .../src/main/js/MainAbility/i18n/zh-CN.json | 8 + .../main/js/MainAbility/pages/index/index.css | 30 + .../main/js/MainAbility/pages/index/index.hml | 5 + .../main/js/MainAbility}/pages/index/index.js | 91 +- .../src/main/js/TestAbility/app.js | 23 + .../src/main/js/TestAbility/i18n/en-US.json | 8 + .../src/main/js/TestAbility/i18n/zh-CN.json | 8 + .../main/js/TestAbility/pages/index/index.css | 30 + .../main/js/TestAbility/pages/index/index.hml | 5 + .../main/js/TestAbility/pages/index/index.js | 26 + .../js/TestRunner/OpenHarmonyTestRunner.js | 59 + .../src/main/js/test/Http.fetch.test.js | 886 +-- .../src/main/js/test/List.test.js | 35 +- .../main/resources/base/element/string.json | 24 + .../src/main/resources/base/media/icon.png | Bin 94 files changed, 5027 insertions(+), 6795 deletions(-) delete mode 100644 telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/resources/base/element/string.json delete mode 100644 telephony/telephonyjstest/netmanager_base/dns/entry/src/main/resources/base/element/string.json rename telephony/telephonyjstest/netmanager_base/dns/{entry => }/src/main/config.json (67%) rename telephony/telephonyjstest/netmanager_base/dns/{entry/src/main/js/default => src/main/js/MainAbility}/app.js (80%) rename telephony/telephonyjstest/netmanager_base/{network_nopermission/entry/src/main/js/default => dns/src/main/js/MainAbility}/i18n/en-US.json (91%) rename telephony/telephonyjstest/netmanager_base/{register/entry/src/main/js/default => dns/src/main/js/MainAbility}/i18n/zh-CN.json (91%) rename telephony/telephonyjstest/netmanager_base/dns/{entry/src/main/js/default => src/main/js/MainAbility}/pages/index/index.css (93%) rename telephony/telephonyjstest/netmanager_base/dns/{entry/src/main/js/default => src/main/js/MainAbility}/pages/index/index.hml (94%) rename telephony/telephonyjstest/netmanager_base/{register/entry/src/main/js/default => dns/src/main/js/MainAbility}/pages/index/index.js (68%) create mode 100644 telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestAbility/app.js rename telephony/telephonyjstest/netmanager_base/{register/entry/src/main/js/default => dns/src/main/js/TestAbility}/i18n/en-US.json (91%) rename telephony/telephonyjstest/netmanager_base/{network_nopermission/entry/src/main/js/default => dns/src/main/js/TestAbility}/i18n/zh-CN.json (91%) rename telephony/telephonyjstest/netmanager_base/{network_nopermission/entry/src/main/js/default => dns/src/main/js/TestAbility}/pages/index/index.css (94%) rename telephony/telephonyjstest/netmanager_base/{network_nopermission/entry/src/main/js/default => dns/src/main/js/TestAbility}/pages/index/index.hml (95%) create mode 100644 telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestAbility/pages/index/index.js create mode 100644 telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestRunner/OpenHarmonyTestRunner.js rename telephony/telephonyjstest/netmanager_base/{register/entry/src/main/js/default => dns/src/main/js}/test/List.test.js (77%) rename telephony/telephonyjstest/netmanager_base/dns/{entry => }/src/main/js/test/NetworkManagerDNS.test.js (95%) create mode 100644 telephony/telephonyjstest/netmanager_base/dns/src/main/resources/base/element/string.json rename telephony/telephonyjstest/netmanager_base/dns/{entry/src/main/js => src/main}/resources/base/media/icon.png (100%) delete mode 100644 telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/resources/base/element/string.json delete mode 100644 telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/resources/base/element/string.json rename telephony/telephonyjstest/netmanager_base/network_nopermission/{entry => }/src/main/config.json (50%) rename telephony/telephonyjstest/netmanager_base/{system_fetch/entry/src/main/js/default => network_nopermission/src/main/js/MainAbility}/app.js (97%) rename telephony/telephonyjstest/netmanager_base/{dns/entry/src/main/js/default => network_nopermission/src/main/js/MainAbility}/i18n/en-US.json (91%) rename telephony/telephonyjstest/netmanager_base/{system_fetch/entry/src/main/js/default => network_nopermission/src/main/js/MainAbility}/i18n/zh-CN.json (91%) rename telephony/telephonyjstest/netmanager_base/{system_fetch/entry/src/main/js/default => network_nopermission/src/main/js/MainAbility}/pages/index/index.css (94%) rename telephony/telephonyjstest/netmanager_base/{system_fetch/entry/src/main/js/default => network_nopermission/src/main/js/MainAbility}/pages/index/index.hml (95%) rename telephony/telephonyjstest/netmanager_base/{system_fetch/entry/src/main/js/default => network_nopermission/src/main/js/MainAbility}/pages/index/index.js (68%) create mode 100644 telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestAbility/app.js rename telephony/telephonyjstest/netmanager_base/{system_fetch/entry/src/main/js/default => network_nopermission/src/main/js/TestAbility}/i18n/en-US.json (91%) rename telephony/telephonyjstest/netmanager_base/{dns/entry/src/main/js/default => network_nopermission/src/main/js/TestAbility}/i18n/zh-CN.json (91%) create mode 100644 telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestAbility/pages/index/index.css create mode 100644 telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestAbility/pages/index/index.hml create mode 100644 telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestAbility/pages/index/index.js create mode 100644 telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestRunner/OpenHarmonyTestRunner.js rename telephony/telephonyjstest/netmanager_base/network_nopermission/{entry => }/src/main/js/test/Http.nopermission.test.js (92%) rename telephony/telephonyjstest/netmanager_base/{system_fetch/entry => network_nopermission}/src/main/js/test/List.test.js (77%) create mode 100644 telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/resources/base/element/string.json rename telephony/telephonyjstest/netmanager_base/{dns/entry => network_nopermission}/src/main/resources/base/media/icon.png (100%) delete mode 100644 telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/resources/base/element/string.json delete mode 100644 telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/resources/base/media/icon.png delete mode 100644 telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/test/List.test.js delete mode 100644 telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/test/NetworkManagerRegister.test.js delete mode 100644 telephony/telephonyjstest/netmanager_base/register/entry/src/main/resources/base/element/string.json delete mode 100644 telephony/telephonyjstest/netmanager_base/register/entry/src/main/resources/base/media/icon.png rename telephony/telephonyjstest/netmanager_base/register/{entry => }/src/main/config.json (67%) rename telephony/telephonyjstest/netmanager_base/register/{entry/src/main/js/default => src/main/js/MainAbility}/app.js (97%) create mode 100644 telephony/telephonyjstest/netmanager_base/register/src/main/js/MainAbility/i18n/en-US.json create mode 100644 telephony/telephonyjstest/netmanager_base/register/src/main/js/MainAbility/i18n/zh-CN.json rename telephony/telephonyjstest/netmanager_base/register/{entry/src/main/js/default => src/main/js/MainAbility}/pages/index/index.css (93%) rename telephony/telephonyjstest/netmanager_base/register/{entry/src/main/js/default => src/main/js/MainAbility}/pages/index/index.hml (94%) rename telephony/telephonyjstest/netmanager_base/{dns/entry/src/main/js/default => register/src/main/js/MainAbility}/pages/index/index.js (68%) create mode 100644 telephony/telephonyjstest/netmanager_base/register/src/main/js/TestAbility/app.js create mode 100644 telephony/telephonyjstest/netmanager_base/register/src/main/js/TestAbility/i18n/en-US.json create mode 100644 telephony/telephonyjstest/netmanager_base/register/src/main/js/TestAbility/i18n/zh-CN.json create mode 100644 telephony/telephonyjstest/netmanager_base/register/src/main/js/TestAbility/pages/index/index.css create mode 100644 telephony/telephonyjstest/netmanager_base/register/src/main/js/TestAbility/pages/index/index.hml create mode 100644 telephony/telephonyjstest/netmanager_base/register/src/main/js/TestAbility/pages/index/index.js create mode 100644 telephony/telephonyjstest/netmanager_base/register/src/main/js/TestRunner/OpenHarmonyTestRunner.js rename telephony/telephonyjstest/netmanager_base/{dns/entry => register}/src/main/js/test/List.test.js (76%) rename telephony/telephonyjstest/netmanager_base/register/{entry/src/main/js/default => src/main/js}/test/NetworkManagerRegister.test.js (97%) create mode 100644 telephony/telephonyjstest/netmanager_base/register/src/main/resources/base/element/string.json rename telephony/telephonyjstest/netmanager_base/{network_nopermission/entry/src/main/js => register/src/main}/resources/base/media/icon.png (100%) delete mode 100644 telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/resources/base/element/string.json delete mode 100644 telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/resources/base/media/icon.png delete mode 100644 telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/resources/base/element/string.json delete mode 100644 telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/resources/base/media/icon.png rename telephony/telephonyjstest/netmanager_base/system_fetch/{entry => }/src/main/config.json (51%) rename telephony/telephonyjstest/netmanager_base/{network_nopermission/entry/src/main/js/default => system_fetch/src/main/js/MainAbility}/app.js (97%) create mode 100644 telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/MainAbility/i18n/en-US.json create mode 100644 telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/MainAbility/i18n/zh-CN.json create mode 100644 telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/MainAbility/pages/index/index.css create mode 100644 telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/MainAbility/pages/index/index.hml rename telephony/telephonyjstest/netmanager_base/{network_nopermission/entry/src/main/js/default => system_fetch/src/main/js/MainAbility}/pages/index/index.js (68%) create mode 100644 telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestAbility/app.js create mode 100644 telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestAbility/i18n/en-US.json create mode 100644 telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestAbility/i18n/zh-CN.json create mode 100644 telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestAbility/pages/index/index.css create mode 100644 telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestAbility/pages/index/index.hml create mode 100644 telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestAbility/pages/index/index.js create mode 100644 telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestRunner/OpenHarmonyTestRunner.js rename telephony/telephonyjstest/netmanager_base/system_fetch/{entry => }/src/main/js/test/Http.fetch.test.js (96%) rename telephony/telephonyjstest/netmanager_base/{network_nopermission/entry => system_fetch}/src/main/js/test/List.test.js (78%) create mode 100644 telephony/telephonyjstest/netmanager_base/system_fetch/src/main/resources/base/element/string.json rename telephony/telephonyjstest/netmanager_base/{network_nopermission/entry => system_fetch}/src/main/resources/base/media/icon.png (100%) diff --git a/telephony/telephonyjstest/netmanager_base/dns/BUILD.gn b/telephony/telephonyjstest/netmanager_base/dns/BUILD.gn index 2dba821ee..1ed8da885 100644 --- a/telephony/telephonyjstest/netmanager_base/dns/BUILD.gn +++ b/telephony/telephonyjstest/netmanager_base/dns/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("ActsDNSTest") { - hap_profile = "./entry/src/main/config.json" + hap_profile = "./src/main/config.json" deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", @@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsDNSTest") { hap_name = "ActsDNSTest" } ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" } ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" } diff --git a/telephony/telephonyjstest/netmanager_base/dns/Test.json b/telephony/telephonyjstest/netmanager_base/dns/Test.json index 3ad5aa31c..5d9c2d4a4 100644 --- a/telephony/telephonyjstest/netmanager_base/dns/Test.json +++ b/telephony/telephonyjstest/netmanager_base/dns/Test.json @@ -1,18 +1,20 @@ -{ - "description": "Function test of sim manager interface", - "driver": { - "type": "JSUnitTest", - "test-timeout": "900000", - "package": "com.ohos.dns", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "$module.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} +{ + "description": "Function test of sim manager interface", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "900000", + "bundle-name": "com.ohos.dns", + "package-name": "com.ohos.dns", + "shell-timeout": "900000", + "testcase-timeout": "30000" + }, + "kits": [ + { + "test-file-name": [ + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/resources/base/element/string.json b/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 4a597eff5..000000000 --- a/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "Sim Test" - }, - { - "name": "mainability_description", - "value": "Sim Test - sim manager interface test" - } - ] -} \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 4a597eff5..000000000 --- a/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "Sim Test" - }, - { - "name": "mainability_description", - "value": "Sim Test - sim manager interface test" - } - ] -} \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/config.json b/telephony/telephonyjstest/netmanager_base/dns/src/main/config.json similarity index 67% rename from telephony/telephonyjstest/netmanager_base/dns/entry/src/main/config.json rename to telephony/telephonyjstest/netmanager_base/dns/src/main/config.json index eda9132f4..3b3b3f254 100644 --- a/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/config.json +++ b/telephony/telephonyjstest/netmanager_base/dns/src/main/config.json @@ -1,107 +1,140 @@ -{ - "app": { - "bundleName": "com.ohos.dns", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Release" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.dns", - "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.dns.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.dns", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Release" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.dns", + "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/netmanager_base/dns/entry/src/main/js/default/app.js b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/MainAbility/app.js similarity index 80% rename from telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/default/app.js rename to telephony/telephonyjstest/netmanager_base/dns/src/main/js/MainAbility/app.js index d61b8caa6..f54173a59 100644 --- a/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/default/app.js +++ b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/MainAbility/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) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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"); + } +}; \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/default/i18n/en-US.json b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/MainAbility/i18n/en-US.json similarity index 91% rename from telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/default/i18n/en-US.json rename to telephony/telephonyjstest/netmanager_base/dns/src/main/js/MainAbility/i18n/en-US.json index 55561b837..3cb24b374 100644 --- a/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/default/i18n/en-US.json +++ b/telephony/telephonyjstest/netmanager_base/dns/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/netmanager_base/register/entry/src/main/js/default/i18n/zh-CN.json b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/MainAbility/i18n/zh-CN.json similarity index 91% rename from telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/default/i18n/zh-CN.json rename to telephony/telephonyjstest/netmanager_base/dns/src/main/js/MainAbility/i18n/zh-CN.json index cce1af067..c804e32c0 100644 --- a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/default/i18n/zh-CN.json +++ b/telephony/telephonyjstest/netmanager_base/dns/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/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/default/pages/index/index.css b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/MainAbility/pages/index/index.css similarity index 93% rename from telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/default/pages/index/index.css rename to telephony/telephonyjstest/netmanager_base/dns/src/main/js/MainAbility/pages/index/index.css index 6fda79275..5c52a87a0 100644 --- a/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/default/pages/index/index.css +++ b/telephony/telephonyjstest/netmanager_base/dns/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/netmanager_base/dns/entry/src/main/js/default/pages/index/index.hml b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/MainAbility/pages/index/index.hml similarity index 94% rename from telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/default/pages/index/index.hml rename to telephony/telephonyjstest/netmanager_base/dns/src/main/js/MainAbility/pages/index/index.hml index 1761ec526..18025faf6 100644 --- a/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/default/pages/index/index.hml +++ b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/MainAbility/pages/index/index.hml @@ -1,5 +1,5 @@ -
- - SIM TEST - -
+
+ + SIM TEST + +
diff --git a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/default/pages/index/index.js b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/MainAbility/pages/index/index.js similarity index 68% rename from telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/default/pages/index/index.js rename to telephony/telephonyjstest/netmanager_base/dns/src/main/js/MainAbility/pages/index/index.js index b9a9ded45..faa7cdce4 100644 --- a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/default/pages/index/index.js +++ b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/MainAbility/pages/index/index.js @@ -1,50 +1,43 @@ -/* - * Copyright (C) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES 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) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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 () { + }, }; \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestAbility/app.js b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..e64117c26 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestAbility/app.js @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('TestApplication onCreate'); + }, + onDestroy() { + console.info('TestApplication onDestroy'); + } +}; + diff --git a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/default/i18n/en-US.json b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestAbility/i18n/en-US.json similarity index 91% rename from telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/default/i18n/en-US.json rename to telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestAbility/i18n/en-US.json index 55561b837..3cb24b374 100644 --- a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/default/i18n/en-US.json +++ b/telephony/telephonyjstest/netmanager_base/dns/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/netmanager_base/network_nopermission/entry/src/main/js/default/i18n/zh-CN.json b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestAbility/i18n/zh-CN.json similarity index 91% rename from telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/default/i18n/zh-CN.json rename to telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestAbility/i18n/zh-CN.json index cce1af067..c804e32c0 100644 --- a/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/default/i18n/zh-CN.json +++ b/telephony/telephonyjstest/netmanager_base/dns/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/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/default/pages/index/index.css b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestAbility/pages/index/index.css similarity index 94% rename from telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/default/pages/index/index.css rename to telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestAbility/pages/index/index.css index b21c92c62..b1bcd4338 100644 --- a/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/default/pages/index/index.css +++ b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestAbility/pages/index/index.css @@ -1,30 +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; - } +.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/netmanager_base/network_nopermission/entry/src/main/js/default/pages/index/index.hml b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestAbility/pages/index/index.hml similarity index 95% rename from telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/default/pages/index/index.hml rename to telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestAbility/pages/index/index.hml index f64b040a5..f629c71a9 100644 --- a/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/default/pages/index/index.hml +++ b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestAbility/pages/index/index.hml @@ -1,5 +1,5 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
+
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestAbility/pages/index/index.js b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/dns/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/netmanager_base/dns/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..05ba57825 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/dns/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/netmanager_base/register/entry/src/main/js/default/test/List.test.js b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/test/List.test.js similarity index 77% rename from telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/default/test/List.test.js rename to telephony/telephonyjstest/netmanager_base/dns/src/main/js/test/List.test.js index 896449e39..0db00a6f9 100644 --- a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/default/test/List.test.js +++ b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/test/List.test.js @@ -1,17 +1,19 @@ -/** - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -require('./NetworkManagerRegister.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 Telephony_NETMANAGER_TestDNSTest from './NetworkManagerDNS.test.js' + + export default function testsuite() { + Telephony_NETMANAGER_TestDNSTest() + } diff --git a/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/test/NetworkManagerDNS.test.js b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/test/NetworkManagerDNS.test.js similarity index 95% rename from telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/test/NetworkManagerDNS.test.js rename to telephony/telephonyjstest/netmanager_base/dns/src/main/js/test/NetworkManagerDNS.test.js index e8a82f4b8..4f4c11aad 100644 --- a/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/test/NetworkManagerDNS.test.js +++ b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/test/NetworkManagerDNS.test.js @@ -1,160 +1,162 @@ -/** - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - import netConnection from '@ohos.net.connection'; - import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index'; - - - describe('Telephony_NETMANAGER_TestDNSTest',function(){ - - - it('Telephony_NETMANAGER_TestDNS_Test0100', 0, function(done){ - - netConnection.getDefaultNet().then(function(netHandle){ - netHandle.getAddressesByName("www.baidu.com").then(function(addresses){ - if(addresses === undefined || addresses.length == 0 ){ - console.info('Telephony_NETMANAGER_TestDNS_Test0100 addresses is '+addresses); - expect(false).assertFail(); - }else{ - console.info('Telephony_NETMANAGER_TestDNS_Test0100 is success'); - expect(true).assertTrue(); - } - done(); - }) - }) - }); - - it('Telephony_NETMANAGER_TestDNS_Test0200', 0, function(done){ - - netConnection.getDefaultNet().then(function(netHandle){ - netHandle.getAddressesByName("www.baidu.com", function(err, addresses){ - if(addresses === undefined || addresses.length == 0 ){ - console.info('Telephony_NETMANAGER_TestDNS_Test0200 addresses is '+addresses); - expect(false).assertFail(); - }else{ - console.info('Telephony_NETMANAGER_TestDNS_Test0200 is success'); - expect(true).assertTrue(); - } - done(); - }) - }) - }); - - - it('Telephony_NETMANAGER_TestDNS_Test0300', 0, function(done){ - - netConnection.getDefaultNet().then(function(netHandle){ - netHandle.getAddressByName("www.baidu.com").then(function(address){ - if(address === undefined){ - console.info('Telephony_NETMANAGER_TestDNS_Test0300 addresses is '+address); - expect(false).assertFail(); - }else{ - console.info('Telephony_NETMANAGER_TestDNS_Test0300 is success'); - expect(true).assertTrue(); - } - done(); - }) - }) - }); - - it('Telephony_NETMANAGER_TestDNS_Test0400', 0, function(done){ - - netConnection.getDefaultNet().then(function(netHandle){ - netHandle.getAddressByName("www.baidu.com", function(err, address){ - if(address === undefined ){ - console.info('Telephony_NETMANAGER_TestDNS_Test0400 addresses is '+address); - expect(false).assertFail(); - }else{ - console.info('Telephony_NETMANAGER_TestDNS_Test0400 is success'); - expect(true).assertTrue(); - } - done(); - }) - }) - }); - - it('Telephony_NETMANAGER_TestDNS_Test0500', 0, function(done){ - - netConnection.getDefaultNet().then(function(netHandle){ - netHandle.getAddressesByName("www.askjdbaksjnhd.com").then(function (data) { - if(data !== undefined && data.length !== 0){ - expect(false).assertTrue(); - } - done() - }).catch(function (error) { - if(error === undefined){ - expect(false).assertTrue(); - }else{ - console.info('Telephony_NETMANAGER_TestDNS_Test0500 error is '+JSON.stringify(error)); - } - done(); - }) - }) - }); - - it('Telephony_NETMANAGER_TestDNS_Test0600', 0, function(done){ - - netConnection.getDefaultNet().then(function(netHandle){ - netHandle.getAddressesByName("www.askjdbaksjnhd.com", function(err, addresses){ - if(addresses instanceof Array && addresses.length !== 0 ){ - console.info('Telephony_NETMANAGER_TestDNS_Test0600 addresses is '+addresses); - expect(false).assertFail(); - }else{ - console.info('Telephony_NETMANAGER_TestDNS_Test0600 is success'); - expect(true).assertTrue(); - } - done(); - }) - }) - }); - - - it('Telephony_NETMANAGER_TestDNS_Test0700', 0, function(done){ - - netConnection.getDefaultNet().then(function(netHandle){ - netHandle.getAddressByName("www.askjdbaksjnhd.com").then(function(data) { - if(data !== undefined && data.length !== 0){ - expect(false).assertTrue(); - } - done() - }).catch(function (error){ - if(error !== undefined){ - console.info('Telephony_NETMANAGER_TestDNS_Test0700 error is '+ JSON.stringify(error)); - expect(true).assertTrue(); - }else{ - console.info('Telephony_NETMANAGER_TestDNS_Test0700 is success'); - } - done(); - }) - }) - }); - - it('Telephony_NETMANAGER_TestDNS_Test0800', 0, function(done){ - - netConnection.getDefaultNet().then(function(netHandle){ - netHandle.getAddressByName("www.askjdbaksjnhd.com", function(err, address){ - if(address !== undefined ){ - console.info('Telephony_NETMANAGER_TestDNS_Test0800 address is undefined '+address); - expect(false).assertFail(); - }else{ - console.info('Telephony_NETMANAGER_TestDNS_Test0800 is success'); - expect(true).assertTrue(); - } - 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 netConnection from '@ohos.net.connection'; + + import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +export default function Telephony_NETMANAGER_TestDNSTest() { + + describe('Telephony_NETMANAGER_TestDNSTest',function(){ + + + it('Telephony_NETMANAGER_TestDNS_Test0100', 0, function(done){ + + netConnection.getDefaultNet().then(function(netHandle){ + netHandle.getAddressesByName("www.baidu.com").then(function(addresses){ + if(addresses === undefined || addresses.length == 0 ){ + console.info('Telephony_NETMANAGER_TestDNS_Test0100 addresses is '+addresses); + expect(false).assertFail(); + }else{ + console.info('Telephony_NETMANAGER_TestDNS_Test0100 is success'); + expect(true).assertTrue(); + } + done(); + }) + }) + }); + + it('Telephony_NETMANAGER_TestDNS_Test0200', 0, function(done){ + + netConnection.getDefaultNet().then(function(netHandle){ + netHandle.getAddressesByName("www.baidu.com", function(err, addresses){ + if(addresses === undefined || addresses.length == 0 ){ + console.info('Telephony_NETMANAGER_TestDNS_Test0200 addresses is '+addresses); + expect(false).assertFail(); + }else{ + console.info('Telephony_NETMANAGER_TestDNS_Test0200 is success'); + expect(true).assertTrue(); + } + done(); + }) + }) + }); + + + it('Telephony_NETMANAGER_TestDNS_Test0300', 0, function(done){ + + netConnection.getDefaultNet().then(function(netHandle){ + netHandle.getAddressByName("www.baidu.com").then(function(address){ + if(address === undefined){ + console.info('Telephony_NETMANAGER_TestDNS_Test0300 addresses is '+address); + expect(false).assertFail(); + }else{ + console.info('Telephony_NETMANAGER_TestDNS_Test0300 is success'); + expect(true).assertTrue(); + } + done(); + }) + }) + }); + + it('Telephony_NETMANAGER_TestDNS_Test0400', 0, function(done){ + + netConnection.getDefaultNet().then(function(netHandle){ + netHandle.getAddressByName("www.baidu.com", function(err, address){ + if(address === undefined ){ + console.info('Telephony_NETMANAGER_TestDNS_Test0400 addresses is '+address); + expect(false).assertFail(); + }else{ + console.info('Telephony_NETMANAGER_TestDNS_Test0400 is success'); + expect(true).assertTrue(); + } + done(); + }) + }) + }); + + it('Telephony_NETMANAGER_TestDNS_Test0500', 0, function(done){ + + netConnection.getDefaultNet().then(function(netHandle){ + netHandle.getAddressesByName("www.askjdbaksjnhd.com").then(function (data) { + if(data !== undefined && data.length !== 0){ + expect(false).assertTrue(); + } + done() + }).catch(function (error) { + if(error === undefined){ + expect(false).assertTrue(); + }else{ + console.info('Telephony_NETMANAGER_TestDNS_Test0500 error is '+JSON.stringify(error)); + } + done(); + }) + }) + }); + + it('Telephony_NETMANAGER_TestDNS_Test0600', 0, function(done){ + + netConnection.getDefaultNet().then(function(netHandle){ + netHandle.getAddressesByName("www.askjdbaksjnhd.com", function(err, addresses){ + if(addresses instanceof Array && addresses.length !== 0 ){ + console.info('Telephony_NETMANAGER_TestDNS_Test0600 addresses is '+addresses); + expect(false).assertFail(); + }else{ + console.info('Telephony_NETMANAGER_TestDNS_Test0600 is success'); + expect(true).assertTrue(); + } + done(); + }) + }) + }); + + + it('Telephony_NETMANAGER_TestDNS_Test0700', 0, function(done){ + + netConnection.getDefaultNet().then(function(netHandle){ + netHandle.getAddressByName("www.askjdbaksjnhd.com").then(function(data) { + if(data !== undefined && data.length !== 0){ + expect(false).assertTrue(); + } + done() + }).catch(function (error){ + if(error !== undefined){ + console.info('Telephony_NETMANAGER_TestDNS_Test0700 error is '+ JSON.stringify(error)); + expect(true).assertTrue(); + }else{ + console.info('Telephony_NETMANAGER_TestDNS_Test0700 is success'); + } + done(); + }) + }) + }); + + it('Telephony_NETMANAGER_TestDNS_Test0800', 0, function(done){ + + netConnection.getDefaultNet().then(function(netHandle){ + netHandle.getAddressByName("www.askjdbaksjnhd.com", function(err, address){ + if(address !== undefined ){ + console.info('Telephony_NETMANAGER_TestDNS_Test0800 address is undefined '+address); + expect(false).assertFail(); + }else{ + console.info('Telephony_NETMANAGER_TestDNS_Test0800 is success'); + expect(true).assertTrue(); + } + done(); + }) + }) + }); + + }); +} \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/dns/src/main/resources/base/element/string.json b/telephony/telephonyjstest/netmanager_base/dns/src/main/resources/base/element/string.json new file mode 100644 index 000000000..702c89135 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/dns/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Sim Test" + }, + { + "name": "mainability_description", + "value": "Sim Test - sim manager interface test" + }, + { + "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/netmanager_base/dns/entry/src/main/js/resources/base/media/icon.png b/telephony/telephonyjstest/netmanager_base/dns/src/main/resources/base/media/icon.png similarity index 100% rename from telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/resources/base/media/icon.png rename to telephony/telephonyjstest/netmanager_base/dns/src/main/resources/base/media/icon.png diff --git a/telephony/telephonyjstest/netmanager_base/network_nopermission/BUILD.gn b/telephony/telephonyjstest/netmanager_base/network_nopermission/BUILD.gn index b963ff19a..4e56b8d97 100644 --- a/telephony/telephonyjstest/netmanager_base/network_nopermission/BUILD.gn +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/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("ActsNetworkNopermissionTest") { - hap_profile = "./entry/src/main/config.json" + hap_profile = "./src/main/config.json" deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", @@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsNetworkNopermissionTest") { hap_name = "ActsNetworkNopermissionTest" } ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" } ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" } diff --git a/telephony/telephonyjstest/netmanager_base/network_nopermission/Test.json b/telephony/telephonyjstest/netmanager_base/network_nopermission/Test.json index 79882ec7b..90dadd334 100644 --- a/telephony/telephonyjstest/netmanager_base/network_nopermission/Test.json +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/Test.json @@ -1,18 +1,20 @@ -{ - "description": "Function test of sim manager interface", - "driver": { - "type": "JSUnitTest", - "test-timeout": "900000", - "package": "com.ohos.network_nopermission", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "$module.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} +{ + "description": "Function test of sim manager interface", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "900000", + "bundle-name": "com.ohos.network_nopermission", + "package-name": "com.ohos.network_nopermission", + "shell-timeout": "900000", + "testcase-timeout": "30000" + }, + "kits": [ + { + "test-file-name": [ + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/resources/base/element/string.json b/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 490210a39..000000000 --- a/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "entry_desc", - "value": "description" - }, - { - "name": "MainAbility_desc", - "value": "description" - }, - { - "name": "MainAbility_label", - "value": "label" - } - ] -} \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 490210a39..000000000 --- a/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "entry_desc", - "value": "description" - }, - { - "name": "MainAbility_desc", - "value": "description" - }, - { - "name": "MainAbility_label", - "value": "label" - } - ] -} \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/config.json b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/config.json similarity index 50% rename from telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/config.json rename to telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/config.json index 532249318..304bf8a95 100644 --- a/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/config.json +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/config.json @@ -1,63 +1,94 @@ -{ - "app": { - "vendor": "ohos", - "bundleName": "com.ohos.network_nopermission", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Release" - } - }, - "deviceConfig": {}, - "module": { - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": "com.ohos.network_nopermission.MainAbility", - "icon": "$media:icon", - "description": "$string:MainAbility_desc", - "label": "$string:MainAbility_label", - "type": "page", - "launchType": "standard" - } - ], - "distro": { - "moduleType": "entry", - "deliveryWithInstall": true, - "moduleName": "entry" - }, - "package": "com.ohos.network_nopermission", - "srcPath": "", - "name": ".MyApplication", - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } +{ + "app": { + "vendor": "ohos", + "bundleName": "com.ohos.network_nopermission", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Release" + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "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" + } + ], + "distro": { + "moduleType": "entry", + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.ohos.network_nopermission", + "name": ".entry", + "srcPath":"", + "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/netmanager_base/system_fetch/entry/src/main/js/default/app.js b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/MainAbility/app.js similarity index 97% rename from telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/default/app.js rename to telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/MainAbility/app.js index c132196bf..ad9d5c6f0 100644 --- a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/default/app.js +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/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("Application onCreate"); - }, - onDestroy() { - console.info("Application onDestroy"); - } -}; +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info("Application onCreate"); + }, + onDestroy() { + console.info("Application onDestroy"); + } +}; diff --git a/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/default/i18n/en-US.json b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/MainAbility/i18n/en-US.json similarity index 91% rename from telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/default/i18n/en-US.json rename to telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/MainAbility/i18n/en-US.json index 55561b837..3cb24b374 100644 --- a/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/default/i18n/en-US.json +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/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/netmanager_base/system_fetch/entry/src/main/js/default/i18n/zh-CN.json b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/MainAbility/i18n/zh-CN.json similarity index 91% rename from telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/default/i18n/zh-CN.json rename to telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/MainAbility/i18n/zh-CN.json index cce1af067..c804e32c0 100644 --- a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/default/i18n/zh-CN.json +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/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/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/default/pages/index/index.css b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/MainAbility/pages/index/index.css similarity index 94% rename from telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/default/pages/index/index.css rename to telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/MainAbility/pages/index/index.css index b21c92c62..b1bcd4338 100644 --- a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/default/pages/index/index.css +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/MainAbility/pages/index/index.css @@ -1,30 +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; - } +.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/netmanager_base/system_fetch/entry/src/main/js/default/pages/index/index.hml b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/MainAbility/pages/index/index.hml similarity index 95% rename from telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/default/pages/index/index.hml rename to telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/MainAbility/pages/index/index.hml index f64b040a5..f629c71a9 100644 --- a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/default/pages/index/index.hml +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/MainAbility/pages/index/index.hml @@ -1,5 +1,5 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
+
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/default/pages/index/index.js b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/MainAbility/pages/index/index.js similarity index 68% rename from telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/default/pages/index/index.js rename to telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/MainAbility/pages/index/index.js index 7f55040e7..2c2404015 100644 --- a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/default/pages/index/index.js +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/MainAbility/pages/index/index.js @@ -1,50 +1,43 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import 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 () { + }, }; \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestAbility/app.js b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..e64117c26 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestAbility/app.js @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('TestApplication onCreate'); + }, + onDestroy() { + console.info('TestApplication onDestroy'); + } +}; + diff --git a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/default/i18n/en-US.json b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestAbility/i18n/en-US.json similarity index 91% rename from telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/default/i18n/en-US.json rename to telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestAbility/i18n/en-US.json index 55561b837..3cb24b374 100644 --- a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/default/i18n/en-US.json +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/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/netmanager_base/dns/entry/src/main/js/default/i18n/zh-CN.json b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestAbility/i18n/zh-CN.json similarity index 91% rename from telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/default/i18n/zh-CN.json rename to telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestAbility/i18n/zh-CN.json index cce1af067..c804e32c0 100644 --- a/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/default/i18n/zh-CN.json +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/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/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestAbility/pages/index/index.css b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 000000000..b1bcd4338 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/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/netmanager_base/network_nopermission/src/main/js/TestAbility/pages/index/index.hml b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..f629c71a9 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestAbility/pages/index/index.js b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/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/netmanager_base/network_nopermission/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..05ba57825 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/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/netmanager_base/network_nopermission/entry/src/main/js/test/Http.nopermission.test.js b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/test/Http.nopermission.test.js similarity index 92% rename from telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/test/Http.nopermission.test.js rename to telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/test/Http.nopermission.test.js index dfa0038b4..67dd17082 100644 --- a/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/test/Http.nopermission.test.js +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/test/Http.nopermission.test.js @@ -1,109 +1,111 @@ -/** - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import network from '@system.network'; -import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index'; - -describe("Telephony_NetManager_NetWorkTest", function () { - - /** - * @tc.number Telephony_NetManager_NetWorkTest_GetType_NoPermission_0100 - * @tc.name Whether GetType method is called successfully without permission - * @tc.desc Function test - */ - it("Telephony_NetManager_NetWorkTest_GetType_NoPermission_0100", 0, function (done) { - network.getType({ - success : function(data){ - expect().assertFail() - done(); - }, - fail : function(data,code){ - console.info("NetManager code "+ code) - expect(code === 602).assertTrue() - done(); - }, - complete : function(){ - expect().assertTrue() - done(); - } - }) - done(); - }); - - /** - * @tc.number Telephony_NetManager_NetWorkTest_GetType_NoPermission_0200 - * @tc.name Whether to call GetType method again without permission - * @tc.desc Function test - */ - it("Telephony_NetManager_NetWorkTest_GetType_NoPermission_0200", 0, function (done) { - network.getType({ - success : function(data){ - expect().assertFail() - done(); - }, - fail : function(data,code){ - console.info("NetManager code "+ code) - expect(code === 602).assertTrue() - done(); - }, - complete : function(){ - expect().assertTrue() - done(); - } - }) - done(); - }); - - /** - * @tc.number Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0100 - * @tc.name Whether the subscribe method is called successfully without permission - * @tc.desc Function test - */ - it("Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0100", 0, function (done) { - network.subscribe({ - success : function(data){ - expect().assertFail() - done(); - }, - fail : function(data,code){ - console.info("NetManager code "+ code) - expect(code === 602).assertTrue() - done(); - } - }) - done(); - }) - - /** - * @tc.number Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0200 - * @tc.name Whether to call the subscribe method again without permission - * @tc.desc Function test - */ - it("Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0200", 0, function (done) { - network.subscribe({ - success : function(data){ - expect().assertFail() - done(); - }, - fail : function(data,code){ - console.info("NetManager code "+ code) - expect(code === 602).assertTrue() - done(); - } - }) - done(); - }) - -}); +/** + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License") + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import network from '@system.network'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +export default function Telephony_NetManager_NetWorkTest() { + +describe("Telephony_NetManager_NetWorkTest", function () { + + /** + * @tc.number Telephony_NetManager_NetWorkTest_GetType_NoPermission_0100 + * @tc.name Whether GetType method is called successfully without permission + * @tc.desc Function test + */ + it("Telephony_NetManager_NetWorkTest_GetType_NoPermission_0100", 0, function (done) { + network.getType({ + success : function(data){ + expect().assertFail() + done(); + }, + fail : function(data,code){ + console.info("NetManager code "+ code) + expect(code === 602).assertTrue() + done(); + }, + complete : function(){ + expect().assertTrue() + done(); + } + }) + done(); + }); + + /** + * @tc.number Telephony_NetManager_NetWorkTest_GetType_NoPermission_0200 + * @tc.name Whether to call GetType method again without permission + * @tc.desc Function test + */ + it("Telephony_NetManager_NetWorkTest_GetType_NoPermission_0200", 0, function (done) { + network.getType({ + success : function(data){ + expect().assertFail() + done(); + }, + fail : function(data,code){ + console.info("NetManager code "+ code) + expect(code === 602).assertTrue() + done(); + }, + complete : function(){ + expect().assertTrue() + done(); + } + }) + done(); + }); + + /** + * @tc.number Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0100 + * @tc.name Whether the subscribe method is called successfully without permission + * @tc.desc Function test + */ + it("Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0100", 0, function (done) { + network.subscribe({ + success : function(data){ + expect().assertFail() + done(); + }, + fail : function(data,code){ + console.info("NetManager code "+ code) + expect(code === 602).assertTrue() + done(); + } + }) + done(); + }) + + /** + * @tc.number Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0200 + * @tc.name Whether to call the subscribe method again without permission + * @tc.desc Function test + */ + it("Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0200", 0, function (done) { + network.subscribe({ + success : function(data){ + expect().assertFail() + done(); + }, + fail : function(data,code){ + console.info("NetManager code "+ code) + expect(code === 602).assertTrue() + done(); + } + }) + done(); + }) + +}); +} diff --git a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/test/List.test.js b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/test/List.test.js similarity index 77% rename from telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/test/List.test.js rename to telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/test/List.test.js index c33bac942..0f81dbf5a 100644 --- a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/test/List.test.js +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/test/List.test.js @@ -1,17 +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. - */ - - -require('./Http.fetch.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 Telephony_NetManager_NetWorkTest from './Http.nopermission.test.js' + + export default function testsuite() { + Telephony_NetManager_NetWorkTest() + } + diff --git a/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/resources/base/element/string.json b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/resources/base/element/string.json new file mode 100644 index 000000000..0f5ed415f --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "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/netmanager_base/dns/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/resources/base/media/icon.png similarity index 100% rename from telephony/telephonyjstest/netmanager_base/dns/entry/src/main/resources/base/media/icon.png rename to telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/resources/base/media/icon.png diff --git a/telephony/telephonyjstest/netmanager_base/register/BUILD.gn b/telephony/telephonyjstest/netmanager_base/register/BUILD.gn index 91ba75105..dd529c87b 100644 --- a/telephony/telephonyjstest/netmanager_base/register/BUILD.gn +++ b/telephony/telephonyjstest/netmanager_base/register/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("ActsRegisterTest") { - hap_profile = "./entry/src/main/config.json" + hap_profile = "./src/main/config.json" deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", @@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsRegisterTest") { hap_name = "ActsRegisterTest" } ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" } ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" } diff --git a/telephony/telephonyjstest/netmanager_base/register/Test.json b/telephony/telephonyjstest/netmanager_base/register/Test.json index 20d624219..6c38c533a 100644 --- a/telephony/telephonyjstest/netmanager_base/register/Test.json +++ b/telephony/telephonyjstest/netmanager_base/register/Test.json @@ -1,18 +1,20 @@ -{ - "description": "Function test of sim manager interface", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1800000", - "package": "com.ohos.register", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "$module.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} +{ + "description": "Function test of sim manager interface", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "1800000", + "bundle-name": "com.ohos.register", + "package-name": "com.ohos.register", + "shell-timeout": "1800000", + "testcase-timeout": "30000" + }, + "kits": [ + { + "test-file-name": [ + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/resources/base/element/string.json b/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 4a597eff5..000000000 --- a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "Sim Test" - }, - { - "name": "mainability_description", - "value": "Sim Test - sim manager interface test" - } - ] -} \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/resources/base/media/icon.png b/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6790 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 { - setTimeout(() => { - resolve(); - }, timeout); - }) - } - - function sleepOther(timeout) { - for (var t = Date.now(); Date.now() - t <= timeout;) ; - } - function sleep(time) { - return new Promise((resolve)=>setTimeout(resolve,time)); - } - - /** - *@tc.number Telephony_NetworkManager_register_Async_0100 - *@tc.name Enter bearerTypes and networkCap asempty, set class NetConnection, - * call Register() to activate the default network, and see if the callback information is generated - @tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0100', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_0100'; - let netConn = connection.createNetConnection(); - let returnValue = 0; - netConn.on('netAvailable', (value) => { - if (value === undefined) { - console.info(`${caseName} on netAvailable fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable :` + value.netId); - returnValue = value.netId; - } - }); - netConn.on('netCapabilitiesChange', (value) => { - if (value === undefined) { - console.info(`${caseName} netCapabilitiesChange fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle =:` + value.handle.netId); - expect(value.handle.netId).assertEqual(ETH_100); - } - }); - netConn.on('netConnectionPropertiesChange', (value) => { - if (value === undefined) { - console.info(`${caseName} netConnectionPropertiesChange fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (value) => { - if (error) { - console.info(`${caseName} netLost fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost: ` + value.netId); - } - }); - netConn.register((error) => { - if (error) { - console.info(JSON.stringify(error) + `${caseName} register fail: ${error}`); - done(); - } - }); - await sleep(DELAY); - console.info(`${caseName} returnVaule : ` + returnValue); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - done(); - } - done(); - }); - done(); - }); - - /** - *@tc.number Telephony_NetworkManager_register_Async_0200 - *@tc.name Enter bearerTypes and networkCap asempty, set class NetConnection, - * call Register() to activate the default network, and see if the callback information is generated - @tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0200', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_0200'; - let netSpecifier = { - netCapabilities: { - bearerTypes: [1], - } - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (value) => { - if (value === undefined) { - console.info(`${caseName} on netAvailable fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - returnValue = value.netId; - } - }); - netConn.on('netCapabilitiesChange', (value) => { - if (value === undefined) { - console.info(`${caseName} netCapabilitiesChange fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle =:` + value.handle.netId); - expect(value.handle.netId).assertEqual(ETH_100); - } - }); - netConn.on('netConnectionPropertiesChange', (value) => { - if (value === undefined) { - console.info(`${caseName} netConnectionPropertiesChange fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle =:` + value.handle.netId); - } - }); - netConn.on('netLost', (value) => { - if (error) { - console.info(`${caseName} netLost fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost : ` + value.netId); - } - }); - netConn.on('netUnavailable', (value) => { - if (error) { - console.info(`${caseName} netUnavailable fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable: ` + value.netId); - } - }); - netConn.on('netBlockStatuschange', (value) => { - if (error) { - console.info(`${caseName} netBlockStatusChange fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange : ` + value.netId); - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(DELAY); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregisterresult: ${error}` + JSON.stringify(error)); - done(); - } - }); - done(); - }); - - /* - *@tc.number Telephony_NetworkManager_register_Async_0300 - *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, - * call Register ()to activate the default network,and see if the callback information is generated - *@tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0300', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_0300'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [11], - }, bearPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable:` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost = :` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable = :` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(DELAY); - console.info(`${caseName} netId : ${netId}`); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result: ${error}`); - } - }); - done(); - }); - - /* - *@tc.number Telephony_NetworkManager_register_Async_0400 - *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, - * call Register ()to activate the default network,and see if the callback information is generated - *@tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0400', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_0400'; - let netId = 0; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [12], - }, bearPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable:` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost = :` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable = :` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result: ${error.code},${error.message}`); - } - }); - done(); - }); - - /* - *@tc.number Telephony_NetworkManager_register_Async_0500 - *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, - * call Register() to activate the default network,and see if the callback information is generated - *@tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0500', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_rgister_Async_0500'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [15], - }, bearPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable:` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost = :` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable = :` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result: ${error}`); - } - done(); - }); - done(); - }); - - /* - *@tc.number Telephony_NetworkManager_register_Async_0600 - *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, - * call Register() to activate the default network,and see if the callback information is generated - *@tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0600', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_rgister_Async_0600'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [16], - }, bearPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - let netId = 0; - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable:` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost = :` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable = :` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result: ${error}`); - } - done(); - }); - done(); - }); - - /* - *@tc.number Telephony_NetworkManager_register_Async_0700 - *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, - * call Register() to activate the default network,and see if the callback information is generated - *@tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0700', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_rgister_Async_0700'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [17], - }, bearPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - let netId = 0; - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable:` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost = :` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable = :` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result: ${error}`); - } - done(); - }); - done(); - }); - - /* - *@tc.number Telephony_NetworkManager_register_Async_0800 - *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, - * call Register() to activate the default network,and see if the callback information is generated - *@tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0800', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_rgister_Async_0800'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [1], - networkCap: [0], - }, bearPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - let netId = 0; - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable:` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost = :` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable = :` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result: ${error}`); - } - done(); - }); - done(); - }); - - /* - *@tc.number Telephony_NetworkManager_register_Async_0900 - *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, - * call Register() to activate the default network,and see if the callback information is generated - *@tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0900', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_rgister_Async_0900'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [1], - networkCap: [12], - }, bearPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - let netId = 0; - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable:` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost = :` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable = :` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result: ${error}`); - } - done(); - }); - done(); - }); - - /* - *@tc.number Telephony_NetworkManager_register_Async_1000 - *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, - * call Register() to activate the default network,and see if the callback information is generated - *@tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_1000', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_rgister_Async_1000'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [1], - networkCap: [12], - }, bearPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - let netId = 0; - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable:` + value.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost = :` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable = :` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result: ${error}`); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_1100 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1100', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1100'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [1], - networkCap: [15], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value.netId); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_1200 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1200', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1200'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [1], - networkCap: [16], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value.netId); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - - /** - * @tc.number Telephony_NetworkManager_register_Async_1300 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1300', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1300'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [1], - networkCap: [17], - }, bearerPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - expect(value.handle.netId).assertEqual(ETH_100); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - expect(value.handle.netId).assertEqual(ETH_100); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - expect(value.handle.netId).assertEqual(ETH_100); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - - /** - * @tc.number Telephony_NetworkManager_register_Async_1400 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1400', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1400'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [2], - networkCap: [12], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value.netId); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_1500 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1500', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1500'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [3], - networkCap: [12], - }, bearerPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - VALUE = value.netId; - expect(VALUE).assertEqual(ETH_100); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - - /** - * @tc.number Telephony_NetworkManager_register_Async_1600 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1600', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1600'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [4], - networkCap: [12], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_1700 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1700', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1700'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [5], - networkCap: [17], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_1800 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1800', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1800'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [4], - networkCap: [12], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - await sleep(DELAY); - let netConn1 = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn1.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn1.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - netId = true; - } - }); - netConn1.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn1.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_1900 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1900', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1900'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [6], - networkCap: [18], - }, bearerPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - } - }); - netConn.register((error) => { - if (error) { - - done(); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_2000 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_2000', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_2000'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [0], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - expect(false).assertTrue() - done(); - }); - netConn.on('netBlockStatusChange', (error, value) => { - expect(false).assertTrue() - done(); - }); - netConn.on('netCapabilitiesChange', (error, value) => { - expect(false).assertTrue() - done(); - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - expect(false).assertTrue() - done(); - }); - netConn.on('netLost', (error, value) => { - expect(false).assertTrue() - done(); - }); - netConn.on('netUnavailable', (error, value) => { - done(); - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_2100 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_2100', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_2100'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [0], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - let netSpecifier1 = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [12], - }, bearerPrivateIdentifier: '123' - } - let netConn1 = connection.createNetConnection(netSpecifier1, TIMEOUT); - netConn1.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn1.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn1.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - netId = true; - } - }); - netConn1.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn1.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_2200 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_2200', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_2200'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [0], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value.netId); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - let netSpecifier1 = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [1], - networkCap: [12], - }, bearerPrivateIdentifier: '123' - } - let netConn1 = connection.createNetConnection(netSpecifier1, TIMEOUT); - netConn1.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn1.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn1.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value.netId); - netId = true; - } - }); - netConn1.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn1.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_2300 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_2300', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_2300'; - let netConn = connection.createNetConnection(); - let returnValue = 0; - netConn.on('netAvailable', (value) => { - if (value === undefined) { - console.info(`${caseName} on netAvailable fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable` + value.netId); - returnValue = value.netId; - } - }); - netConn.on('netCapabilitiesChange', (value) => { - if (value === undefined) { - console.info(`${caseName} on netCapabilitiesChange fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle ` + value.netHandle.netId); - expect(value.netHandle.netId > ETH_100 ).assertTrue(); - } - }); - netConn.on('netConnectionPropertiesChange', (value) => { - if (value === undefined) { - console.info(`${caseName} on netConnectionPropertiesChange fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange hdndle` + value.netHandle.netId); - } - }); - netConn.on('netLost', (value) => { - if (error) { - console.info(`${caseName} netLost fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - console.info(`${caseName} returnValue ` + returnValue); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - done(); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_unregister_Async_0100 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - it('Telephony_NetworkManager_unregister_Async_0100', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_unregister_Async_0100'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [0], - }, bearerPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT_1); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - done(); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - done(); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value.netId); - done(); - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - expect().assertFail(); - done(); - } - - done(); - }); - done(); - }); - - - /** - * @tc.number Telephony_NetworkManager_unregister_Async_0200 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - it('Telephony_NetworkManager_unregister_Async_0200', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_unregister_Async_0200'; - let netConn = connection.createNetConnection(); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - done(); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - done(); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value.netId); - done(); - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - expect().assertFail(); - done(); - } - - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_unregister_Async_0300 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - it('Telephony_NetworkManager_unregister_Async_0300', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_unregister_Async_0300'; - let netConn = connection.createNetConnection(); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - done(); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - done(); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value.netId); - done(); - } - }); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - expect().assertFail(); - done(); - } - await sleep(1000); - done(); - }); - done(); - }); - - }); - - - \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/netmanager_base/register/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 4a597eff5..000000000 --- a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "Sim Test" - }, - { - "name": "mainability_description", - "value": "Sim Test - sim manager interface test" - } - ] -} \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/netmanager_base/register/entry/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6790 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 - - SIM TEST - - +
+ + SIM TEST + +
diff --git a/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/default/pages/index/index.js b/telephony/telephonyjstest/netmanager_base/register/src/main/js/MainAbility/pages/index/index.js similarity index 68% rename from telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/default/pages/index/index.js rename to telephony/telephonyjstest/netmanager_base/register/src/main/js/MainAbility/pages/index/index.js index 9c3a39b84..faa7cdce4 100644 --- a/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/default/pages/index/index.js +++ b/telephony/telephonyjstest/netmanager_base/register/src/main/js/MainAbility/pages/index/index.js @@ -1,50 +1,43 @@ -/* - * Copyright (C) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES 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) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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 () { + }, }; \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/register/src/main/js/TestAbility/app.js b/telephony/telephonyjstest/netmanager_base/register/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..e64117c26 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/register/src/main/js/TestAbility/app.js @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('TestApplication onCreate'); + }, + onDestroy() { + console.info('TestApplication onDestroy'); + } +}; + diff --git a/telephony/telephonyjstest/netmanager_base/register/src/main/js/TestAbility/i18n/en-US.json b/telephony/telephonyjstest/netmanager_base/register/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/register/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/netmanager_base/register/src/main/js/TestAbility/i18n/zh-CN.json b/telephony/telephonyjstest/netmanager_base/register/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/register/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/netmanager_base/register/src/main/js/TestAbility/pages/index/index.css b/telephony/telephonyjstest/netmanager_base/register/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 000000000..b1bcd4338 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/register/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/netmanager_base/register/src/main/js/TestAbility/pages/index/index.hml b/telephony/telephonyjstest/netmanager_base/register/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..f629c71a9 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/register/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/telephony/telephonyjstest/netmanager_base/register/src/main/js/TestAbility/pages/index/index.js b/telephony/telephonyjstest/netmanager_base/register/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/register/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/netmanager_base/register/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/telephony/telephonyjstest/netmanager_base/register/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..05ba57825 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/register/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/netmanager_base/dns/entry/src/main/js/test/List.test.js b/telephony/telephonyjstest/netmanager_base/register/src/main/js/test/List.test.js similarity index 76% rename from telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/test/List.test.js rename to telephony/telephonyjstest/netmanager_base/register/src/main/js/test/List.test.js index d1ece5bac..083e55ebd 100644 --- a/telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/test/List.test.js +++ b/telephony/telephonyjstest/netmanager_base/register/src/main/js/test/List.test.js @@ -1,17 +1,19 @@ -/** - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -require('./NetworkManagerDNS.test'); \ 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 Telephony_NetworkManagerRegisterTest from './NetworkManagerRegister.test.js' + + export default function testsuite() { + Telephony_NetworkManagerRegisterTest() + } \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/default/test/NetworkManagerRegister.test.js b/telephony/telephonyjstest/netmanager_base/register/src/main/js/test/NetworkManagerRegister.test.js similarity index 97% rename from telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/default/test/NetworkManagerRegister.test.js rename to telephony/telephonyjstest/netmanager_base/register/src/main/js/test/NetworkManagerRegister.test.js index baa67913f..e74690684 100644 --- a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/default/test/NetworkManagerRegister.test.js +++ b/telephony/telephonyjstest/netmanager_base/register/src/main/js/test/NetworkManagerRegister.test.js @@ -1,2509 +1,2510 @@ -/** - * Copyright (C) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - - import connection from '@ohos.net.connection'; - import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index'; - - describe('Telephony_NetworkManagerRegisterTest', function () { - - const ETH_100 = 100; - const TEST_RUN_TIME_2 = 2; - const TEST_RUN_TIME_5 = 5; - const TEST_RUN_TIME_1000 = 1000; - const DELAY = 1000; - const DELAY_TIME = 1000; - const TIMEOUT = 100; - const TIMEOUT_1 = 1000; - let VALUE = 0; - - function sleep(timeout) { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(); - }, timeout); - }) - } - - function sleepOther(timeout) { - for (var t = Date.now(); Date.now() - t <= timeout;) ; - } - - /** - *@tc.number Telephony_NetworkManager_register_Async_0100 - *@tc.name Enter bearerTypes and networkCap asempty, set class NetConnection, - * call Register() to activate the default network, and see if the callback information is generated - @tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0100', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_0100'; - let netConn = connection.createNetConnection(); - let returnValue = 0; - netConn.on('netAvailable', (value) => { - if (value === undefined) { - console.info(`${caseName} on netAvailable fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable :` + value.netId); - returnValue = value.netId; - } - }); - netConn.on('netCapabilitiesChange', (value) => { - if (value === undefined) { - console.info(`${caseName} netCapabilitiesChange fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle =:` + value.handle.netId); - expect(value.handle.netId).assertEqual(ETH_100); - } - }); - netConn.on('netConnectionPropertiesChange', (value) => { - if (value === undefined) { - console.info(`${caseName} netConnectionPropertiesChange fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (value) => { - if (error) { - console.info(`${caseName} netLost fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost: ` + value.netId); - } - }); - netConn.register((error) => { - if (error) { - console.info(JSON.stringify(error) + `${caseName} register fail: ${error}`); - done(); - } - }); - await sleep(DELAY); - console.info(`${caseName} returnVaule : ` + returnValue); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - done(); - } - done(); - }); - done(); - }); - - /** - *@tc.number Telephony_NetworkManager_register_Async_0200 - *@tc.name Enter bearerTypes and networkCap asempty, set class NetConnection, - * call Register() to activate the default network, and see if the callback information is generated - @tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0200', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_0200'; - let netSpecifier = { - netCapabilities: { - bearerTypes: [1], - } - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (value) => { - if (value === undefined) { - console.info(`${caseName} on netAvailable fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - returnValue = value.netId; - } - }); - netConn.on('netCapabilitiesChange', (value) => { - if (value === undefined) { - console.info(`${caseName} netCapabilitiesChange fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle =:` + value.handle.netId); - expect(value.handle.netId).assertEqual(ETH_100); - } - }); - netConn.on('netConnectionPropertiesChange', (value) => { - if (value === undefined) { - console.info(`${caseName} netConnectionPropertiesChange fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle =:` + value.handle.netId); - } - }); - netConn.on('netLost', (value) => { - if (error) { - console.info(`${caseName} netLost fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost : ` + value.netId); - } - }); - netConn.on('netUnavailable', (value) => { - if (error) { - console.info(`${caseName} netUnavailable fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable: ` + value.netId); - } - }); - netConn.on('netBlockStatuschange', (value) => { - if (error) { - console.info(`${caseName} netBlockStatusChange fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange : ` + value.netId); - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(DELAY); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregisterresult: ${error}` + JSON.stringify(error)); - done(); - } - }); - done(); - }); - - /* - *@tc.number Telephony_NetworkManager_register_Async_0300 - *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, - * call Register ()to activate the default network,and see if the callback information is generated - *@tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0300', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_0300'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [11], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable:` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost = :` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable = :` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(DELAY); - console.info(`${caseName} netId : ${netId}`); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result: ${error}`); - } - }); - done(); - }); - - /* - *@tc.number Telephony_NetworkManager_register_Async_0400 - *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, - * call Register ()to activate the default network,and see if the callback information is generated - *@tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0400', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_0400'; - let netId = 0; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [12], - }, bearerPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable:` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost = :` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable = :` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result: ${error.code},${error.message}`); - } - }); - done(); - }); - - /* - *@tc.number Telephony_NetworkManager_register_Async_0500 - *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, - * call Register() to activate the default network,and see if the callback information is generated - *@tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0500', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_rgister_Async_0500'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [15], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable:` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost = :` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable = :` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result: ${error}`); - } - done(); - }); - done(); - }); - - /* - *@tc.number Telephony_NetworkManager_register_Async_0600 - *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, - * call Register() to activate the default network,and see if the callback information is generated - *@tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0600', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_rgister_Async_0600'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [16], - }, bearerPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - let netId = 0; - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable:` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost = :` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable = :` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result: ${error}`); - } - done(); - }); - done(); - }); - - /* - *@tc.number Telephony_NetworkManager_register_Async_0700 - *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, - * call Register() to activate the default network,and see if the callback information is generated - *@tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0700', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_rgister_Async_0700'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [17], - }, bearerPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - let netId = 0; - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable:` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost = :` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable = :` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result: ${error}`); - } - done(); - }); - done(); - }); - - /* - *@tc.number Telephony_NetworkManager_register_Async_0800 - *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, - * call Register() to activate the default network,and see if the callback information is generated - *@tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0800', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_rgister_Async_0800'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [1], - networkCap: [0], - }, bearerPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - let netId = 0; - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable:` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost = :` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable = :` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result: ${error}`); - } - done(); - }); - done(); - }); - - /* - *@tc.number Telephony_NetworkManager_register_Async_0900 - *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, - * call Register() to activate the default network,and see if the callback information is generated - *@tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_0900', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_rgister_Async_0900'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [1], - networkCap: [12], - }, bearerPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - let netId = 0; - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable:` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost = :` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable = :` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(10000); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result: ${error}`); - } - done(); - }); - done(); - }); - - /* - *@tc.number Telephony_NetworkManager_register_Async_1000 - *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, - * call Register() to activate the default network,and see if the callback information is generated - *@tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_1000', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_rgister_Async_1000'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [1], - networkCap: [12], - }, bearerPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - let netId = 0; - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable:` + value.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost = :` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable = :` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result: ${error}`); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_1100 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1100', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1100'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [1], - networkCap: [15], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value.netId); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_1200 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1200', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1200'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [1], - networkCap: [16], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value.netId); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - - /** - * @tc.number Telephony_NetworkManager_register_Async_1300 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1300', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1300'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [1], - networkCap: [17], - }, bearerPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - expect(value.netId).assertEqual(ETH_100); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - expect(value.handle.netId).assertEqual(ETH_100); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - expect(value.handle.netId).assertEqual(ETH_100); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - expect(value.handle.netId).assertEqual(ETH_100); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - - /** - * @tc.number Telephony_NetworkManager_register_Async_1400 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1400', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1400'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [2], - networkCap: [12], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value.netId); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_1500 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1500', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1500'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [3], - networkCap: [12], - }, bearerPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - VALUE = value.netId; - expect(VALUE).assertEqual(ETH_100); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - - /** - * @tc.number Telephony_NetworkManager_register_Async_1600 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1600', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1600'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [4], - networkCap: [12], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_1700 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1700', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1700'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [5], - networkCap: [17], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_1800 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1800', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1800'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [4], - networkCap: [12], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - await sleep(DELAY); - let netConn1 = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn1.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn1.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - netId = true; - } - }); - netConn1.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn1.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_1900 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_1900', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_1900'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [6], - networkCap: [18], - }, bearerPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - } - }); - netConn.register((error) => { - if (error) { - - done(); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_2000 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - - it('Telephony_NetworkManager_register_Async_2000', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_2000'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [0], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - expect(false).assertTrue() - done(); - }); - netConn.on('netBlockStatusChange', (error, value) => { - expect(false).assertTrue() - done(); - }); - netConn.on('netCapabilitiesChange', (error, value) => { - expect(false).assertTrue() - done(); - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - expect(false).assertTrue() - done(); - }); - netConn.on('netLost', (error, value) => { - expect(false).assertTrue() - done(); - }); - netConn.on('netUnavailable', (error, value) => { - done(); - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_2100 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_2100', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_2100'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [0], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - let netSpecifier1 = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [12], - }, bearerPrivateIdentifier: '123' - } - let netConn1 = connection.createNetConnection(netSpecifier1, TIMEOUT); - netConn1.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn1.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn1.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value); - netId = true; - } - }); - netConn1.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn1.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_2200 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_2200', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_2200'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [0], - }, bearerPrivateIdentifier: '123' - } - let netId = 0; - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value.netId); - netId = true; - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - let netSpecifier1 = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [1], - networkCap: [12], - }, bearerPrivateIdentifier: '123' - } - let netConn1 = connection.createNetConnection(netSpecifier1, TIMEOUT); - netConn1.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - } - }); - netConn1.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - } - }); - netConn1.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn1.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value.netId); - netId = true; - } - }); - netConn1.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - expect(true).assertTrue() - netConn1.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_register_Async_2300 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - it('Telephony_NetworkManager_register_Async_2300', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_register_Async_2300'; - let netConn = connection.createNetConnection(); - let returnValue = 0; - netConn.on('netAvailable', (value) => { - if (value === undefined) { - console.info(`${caseName} on netAvailable fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable` + value.netId); - returnValue = value.netId; - } - }); - netConn.on('netCapabilitiesChange', (value) => { - if (value === undefined) { - console.info(`${caseName} on netCapabilitiesChange fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle ` + value.netHandle.netId); - expect(value.netHandle.netId > ETH_100 ).assertTrue(); - } - }); - netConn.on('netConnectionPropertiesChange', (value) => { - if (value === undefined) { - console.info(`${caseName} on netConnectionPropertiesChange fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange hdndle` + value.netHandle.netId); - } - }); - netConn.on('netLost', (value) => { - if (error) { - console.info(`${caseName} netLost fail`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - await sleep(DELAY); - console.info(`${caseName} returnValue ` + returnValue); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - done(); - } - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_unregister_Async_0100 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - it('Telephony_NetworkManager_unregister_Async_0100', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_unregister_Async_0100'; - let netSpecifier = { - netCapabilities: { - linkUpBandwidthKbps: 0, - linkDownBandwidthKbps: 0, - bearerTypes: [0], - networkCap: [0], - }, bearerPrivateIdentifier: '123' - } - let netConn = connection.createNetConnection(netSpecifier, TIMEOUT_1); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - done(); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - done(); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value.netId); - done(); - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - expect().assertFail(); - done(); - } - - done(); - }); - done(); - }); - - - /** - * @tc.number Telephony_NetworkManager_unregister_Async_0200 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - it('Telephony_NetworkManager_unregister_Async_0200', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_unregister_Async_0200'; - let netConn = connection.createNetConnection(); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - done(); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - done(); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value.netId); - done(); - } - }); - netConn.register((error) => { - if (error) { - console.info(`${caseName} register fail ${error}`); - } - }); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - expect().assertFail(); - done(); - } - - done(); - }); - done(); - }); - - /** - * @tc.number Telephony_NetworkManager_unregister_Async_0300 - * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, - * call Register () to activate the default network ,and see if the callback information is generated - * @tc.desc Function test - */ - it('Telephony_NetworkManager_unregister_Async_0300', 0, async function (done) { - let caseName = 'Telephony_NetworkManager_unregister_Async_0300'; - let netConn = connection.createNetConnection(); - netConn.on('netAvailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail: ${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netAvailable : ` + value.netId); - done(); - } - }); - netConn.on('netBlockStatusChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netCapabilitiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netConnectionPropertiesChange', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); - done(); - } - }); - netConn.on('netLost', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netLost ` + value.netId); - done(); - } - }); - netConn.on('netUnavailable', (error, value) => { - if (error) { - console.info(`${caseName} register fail :${error}`); - expect().assertFail(); - done(); - } else { - console.info(`${caseName} netUnavailable ` + value.netId); - done(); - } - }); - netConn.unregister((error) => { - if (error) { - console.info(`${caseName} unregister result : ${error}`); - expect().assertFail(); - done(); - } - - done(); - }); - 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 connection from '@ohos.net.connection'; + import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + export default function Telephony_NetworkManagerRegisterTest() { + + describe('Telephony_NetworkManagerRegisterTest', function () { + + const ETH_100 = 100; + const TEST_RUN_TIME_2 = 2; + const TEST_RUN_TIME_5 = 5; + const TEST_RUN_TIME_1000 = 1000; + const DELAY = 1000; + const DELAY_TIME = 1000; + const TIMEOUT = 100; + const TIMEOUT_1 = 1000; + let VALUE = 0; + + function sleep(timeout) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve(); + }, timeout); + }) + } + + function sleepOther(timeout) { + for (var t = Date.now(); Date.now() - t <= timeout;) ; + } + + /** + *@tc.number Telephony_NetworkManager_register_Async_0100 + *@tc.name Enter bearerTypes and networkCap asempty, set class NetConnection, + * call Register() to activate the default network, and see if the callback information is generated + @tc.desc Function test + */ + it('Telephony_NetworkManager_register_Async_0100', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_register_Async_0100'; + let netConn = connection.createNetConnection(); + let returnValue = 0; + netConn.on('netAvailable', (value) => { + if (value === undefined) { + console.info(`${caseName} on netAvailable fail`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable :` + value.netId); + returnValue = value.netId; + } + }); + netConn.on('netCapabilitiesChange', (value) => { + if (value === undefined) { + console.info(`${caseName} netCapabilitiesChange fail`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle =:` + value.handle.netId); + expect(value.handle.netId).assertEqual(ETH_100); + } + }); + netConn.on('netConnectionPropertiesChange', (value) => { + if (value === undefined) { + console.info(`${caseName} netConnectionPropertiesChange fail`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netLost', (value) => { + if (error) { + console.info(`${caseName} netLost fail`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost: ` + value.netId); + } + }); + netConn.register((error) => { + if (error) { + console.info(JSON.stringify(error) + `${caseName} register fail: ${error}`); + done(); + } + }); + await sleep(DELAY); + console.info(`${caseName} returnVaule : ` + returnValue); + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + done(); + } + done(); + }); + done(); + }); + + /** + *@tc.number Telephony_NetworkManager_register_Async_0200 + *@tc.name Enter bearerTypes and networkCap asempty, set class NetConnection, + * call Register() to activate the default network, and see if the callback information is generated + @tc.desc Function test + */ + it('Telephony_NetworkManager_register_Async_0200', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_register_Async_0200'; + let netSpecifier = { + netCapabilities: { + bearerTypes: [1], + } + } + let netId = 0; + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + netConn.on('netAvailable', (value) => { + if (value === undefined) { + console.info(`${caseName} on netAvailable fail`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + returnValue = value.netId; + } + }); + netConn.on('netCapabilitiesChange', (value) => { + if (value === undefined) { + console.info(`${caseName} netCapabilitiesChange fail`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle =:` + value.handle.netId); + expect(value.handle.netId).assertEqual(ETH_100); + } + }); + netConn.on('netConnectionPropertiesChange', (value) => { + if (value === undefined) { + console.info(`${caseName} netConnectionPropertiesChange fail`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle =:` + value.handle.netId); + } + }); + netConn.on('netLost', (value) => { + if (error) { + console.info(`${caseName} netLost fail`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost : ` + value.netId); + } + }); + netConn.on('netUnavailable', (value) => { + if (error) { + console.info(`${caseName} netUnavailable fail`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable: ` + value.netId); + } + }); + netConn.on('netBlockStatuschange', (value) => { + if (error) { + console.info(`${caseName} netBlockStatusChange fail`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange : ` + value.netId); + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + } + }); + await sleep(DELAY); + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregisterresult: ${error}` + JSON.stringify(error)); + done(); + } + }); + done(); + }); + + /* + *@tc.number Telephony_NetworkManager_register_Async_0300 + *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, + * call Register ()to activate the default network,and see if the callback information is generated + *@tc.desc Function test + */ + it('Telephony_NetworkManager_register_Async_0300', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_register_Async_0300'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [0], + networkCap: [11], + }, bearerPrivateIdentifier: '123' + } + let netId = 0; + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable:` + value.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost = :` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable = :` + value); + netId = true; + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + } + }); + await sleep(DELAY); + console.info(`${caseName} netId : ${netId}`); + expect(true).assertTrue() + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result: ${error}`); + } + }); + done(); + }); + + /* + *@tc.number Telephony_NetworkManager_register_Async_0400 + *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, + * call Register ()to activate the default network,and see if the callback information is generated + *@tc.desc Function test + */ + it('Telephony_NetworkManager_register_Async_0400', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_register_Async_0400'; + let netId = 0; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [0], + networkCap: [12], + }, bearerPrivateIdentifier: '123' + } + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable:` + value.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost = :` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable = :` + value); + netId = true; + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + } + }); + await sleep(DELAY); + expect(true).assertTrue() + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result: ${error.code},${error.message}`); + } + }); + done(); + }); + + /* + *@tc.number Telephony_NetworkManager_register_Async_0500 + *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, + * call Register() to activate the default network,and see if the callback information is generated + *@tc.desc Function test + */ + it('Telephony_NetworkManager_register_Async_0500', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_rgister_Async_0500'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [0], + networkCap: [15], + }, bearerPrivateIdentifier: '123' + } + let netId = 0; + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable:` + value.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost = :` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable = :` + value); + netId = true; + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + } + }); + await sleep(DELAY); + expect(true).assertTrue() + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result: ${error}`); + } + done(); + }); + done(); + }); + + /* + *@tc.number Telephony_NetworkManager_register_Async_0600 + *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, + * call Register() to activate the default network,and see if the callback information is generated + *@tc.desc Function test + */ + it('Telephony_NetworkManager_register_Async_0600', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_rgister_Async_0600'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [0], + networkCap: [16], + }, bearerPrivateIdentifier: '123' + } + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + let netId = 0; + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable:` + value.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost = :` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable = :` + value); + netId = true; + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + } + }); + await sleep(DELAY); + expect(true).assertTrue() + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result: ${error}`); + } + done(); + }); + done(); + }); + + /* + *@tc.number Telephony_NetworkManager_register_Async_0700 + *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, + * call Register() to activate the default network,and see if the callback information is generated + *@tc.desc Function test + */ + it('Telephony_NetworkManager_register_Async_0700', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_rgister_Async_0700'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [0], + networkCap: [17], + }, bearerPrivateIdentifier: '123' + } + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + let netId = 0; + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable:` + value.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost = :` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable = :` + value); + netId = true; + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + } + }); + await sleep(DELAY); + expect(true).assertTrue() + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result: ${error}`); + } + done(); + }); + done(); + }); + + /* + *@tc.number Telephony_NetworkManager_register_Async_0800 + *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, + * call Register() to activate the default network,and see if the callback information is generated + *@tc.desc Function test + */ + it('Telephony_NetworkManager_register_Async_0800', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_rgister_Async_0800'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [1], + networkCap: [0], + }, bearerPrivateIdentifier: '123' + } + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + let netId = 0; + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable:` + value.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost = :` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable = :` + value); + netId = true; + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + } + }); + await sleep(DELAY); + expect(true).assertTrue() + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result: ${error}`); + } + done(); + }); + done(); + }); + + /* + *@tc.number Telephony_NetworkManager_register_Async_0900 + *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, + * call Register() to activate the default network,and see if the callback information is generated + *@tc.desc Function test + */ + it('Telephony_NetworkManager_register_Async_0900', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_rgister_Async_0900'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [1], + networkCap: [12], + }, bearerPrivateIdentifier: '123' + } + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + let netId = 0; + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable:` + value.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + expect(value.netId).assertEqual(ETH_100); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + expect(value.netId).assertEqual(ETH_100); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + expect(value.netId).assertEqual(ETH_100); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost = :` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable = :` + value); + netId = true; + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + } + }); + await sleep(10000); + expect(true).assertTrue() + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result: ${error}`); + } + done(); + }); + done(); + }); + + /* + *@tc.number Telephony_NetworkManager_register_Async_1000 + *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, + * call Register() to activate the default network,and see if the callback information is generated + *@tc.desc Function test + */ + it('Telephony_NetworkManager_register_Async_1000', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_rgister_Async_1000'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [1], + networkCap: [12], + }, bearerPrivateIdentifier: '123' + } + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + let netId = 0; + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable:` + value.netId); + expect(value.netId).assertEqual(ETH_100); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + expect(value.netId).assertEqual(ETH_100); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + expect(value.netId).assertEqual(ETH_100); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost = :` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable = :` + value); + netId = true; + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + } + }); + await sleep(DELAY); + expect(true).assertTrue() + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result: ${error}`); + } + done(); + }); + done(); + }); + + /** + * @tc.number Telephony_NetworkManager_register_Async_1100 + * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, + * call Register () to activate the default network ,and see if the callback information is generated + * @tc.desc Function test + */ + + it('Telephony_NetworkManager_register_Async_1100', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_register_Async_1100'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [1], + networkCap: [15], + }, bearerPrivateIdentifier: '123' + } + let netId = 0; + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + expect(value.netId).assertEqual(ETH_100); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable ` + value.netId); + netId = true; + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail ${error}`); + } + }); + await sleep(DELAY); + expect(true).assertTrue() + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + } + done(); + }); + done(); + }); + + /** + * @tc.number Telephony_NetworkManager_register_Async_1200 + * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, + * call Register () to activate the default network ,and see if the callback information is generated + * @tc.desc Function test + */ + + it('Telephony_NetworkManager_register_Async_1200', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_register_Async_1200'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [1], + networkCap: [16], + }, bearerPrivateIdentifier: '123' + } + let netId = 0; + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + expect(value.netId).assertEqual(ETH_100); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + expect(value.netId).assertEqual(ETH_100); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable ` + value.netId); + netId = true; + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail ${error}`); + } + }); + await sleep(DELAY); + expect(true).assertTrue() + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + } + done(); + }); + done(); + }); + + + /** + * @tc.number Telephony_NetworkManager_register_Async_1300 + * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, + * call Register () to activate the default network ,and see if the callback information is generated + * @tc.desc Function test + */ + + it('Telephony_NetworkManager_register_Async_1300', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_register_Async_1300'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [1], + networkCap: [17], + }, bearerPrivateIdentifier: '123' + } + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + expect(value.netId).assertEqual(ETH_100); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + expect(value.handle.netId).assertEqual(ETH_100); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + expect(value.handle.netId).assertEqual(ETH_100); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + expect(value.handle.netId).assertEqual(ETH_100); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable ` + value); + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail ${error}`); + } + }); + await sleep(DELAY); + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + } + done(); + }); + done(); + }); + + + /** + * @tc.number Telephony_NetworkManager_register_Async_1400 + * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, + * call Register () to activate the default network ,and see if the callback information is generated + * @tc.desc Function test + */ + + it('Telephony_NetworkManager_register_Async_1400', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_register_Async_1400'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [2], + networkCap: [12], + }, bearerPrivateIdentifier: '123' + } + let netId = 0; + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable ` + value.netId); + netId = true; + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail ${error}`); + } + }); + await sleep(DELAY); + expect(true).assertTrue() + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + } + done(); + }); + done(); + }); + + /** + * @tc.number Telephony_NetworkManager_register_Async_1500 + * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, + * call Register () to activate the default network ,and see if the callback information is generated + * @tc.desc Function test + */ + + it('Telephony_NetworkManager_register_Async_1500', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_register_Async_1500'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [3], + networkCap: [12], + }, bearerPrivateIdentifier: '123' + } + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + VALUE = value.netId; + expect(VALUE).assertEqual(ETH_100); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable ` + value); + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail ${error}`); + } + }); + await sleep(DELAY); + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + } + done(); + }); + done(); + }); + + + /** + * @tc.number Telephony_NetworkManager_register_Async_1600 + * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, + * call Register () to activate the default network ,and see if the callback information is generated + * @tc.desc Function test + */ + + it('Telephony_NetworkManager_register_Async_1600', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_register_Async_1600'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [4], + networkCap: [12], + }, bearerPrivateIdentifier: '123' + } + let netId = 0; + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable ` + value); + netId = true; + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail ${error}`); + } + }); + await sleep(DELAY); + expect(true).assertTrue() + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + } + done(); + }); + done(); + }); + + /** + * @tc.number Telephony_NetworkManager_register_Async_1700 + * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, + * call Register () to activate the default network ,and see if the callback information is generated + * @tc.desc Function test + */ + + it('Telephony_NetworkManager_register_Async_1700', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_register_Async_1700'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [5], + networkCap: [17], + }, bearerPrivateIdentifier: '123' + } + let netId = 0; + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable ` + value); + netId = true; + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail ${error}`); + } + }); + await sleep(DELAY); + expect(true).assertTrue() + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + } + done(); + }); + done(); + }); + + /** + * @tc.number Telephony_NetworkManager_register_Async_1800 + * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, + * call Register () to activate the default network ,and see if the callback information is generated + * @tc.desc Function test + */ + + it('Telephony_NetworkManager_register_Async_1800', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_register_Async_1800'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [4], + networkCap: [12], + }, bearerPrivateIdentifier: '123' + } + let netId = 0; + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable ` + value); + netId = true; + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail ${error}`); + } + }); + await sleep(DELAY); + expect(true).assertTrue() + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + } + done(); + }); + await sleep(DELAY); + let netConn1 = connection.createNetConnection(netSpecifier, TIMEOUT); + netConn1.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn1.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn1.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn1.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + } + }); + netConn1.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable ` + value); + netId = true; + } + }); + netConn1.register((error) => { + if (error) { + console.info(`${caseName} register fail ${error}`); + } + }); + await sleep(DELAY); + expect(true).assertTrue() + netConn1.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + } + done(); + }); + done(); + }); + + /** + * @tc.number Telephony_NetworkManager_register_Async_1900 + * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, + * call Register () to activate the default network ,and see if the callback information is generated + * @tc.desc Function test + */ + + it('Telephony_NetworkManager_register_Async_1900', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_register_Async_1900'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [6], + networkCap: [18], + }, bearerPrivateIdentifier: '123' + } + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable ` + value); + } + }); + netConn.register((error) => { + if (error) { + + done(); + } + done(); + }); + done(); + }); + + /** + * @tc.number Telephony_NetworkManager_register_Async_2000 + * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, + * call Register () to activate the default network ,and see if the callback information is generated + * @tc.desc Function test + */ + + it('Telephony_NetworkManager_register_Async_2000', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_register_Async_2000'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [0], + networkCap: [0], + }, bearerPrivateIdentifier: '123' + } + let netId = 0; + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + netConn.on('netAvailable', (error, value) => { + expect(false).assertTrue() + done(); + }); + netConn.on('netBlockStatusChange', (error, value) => { + expect(false).assertTrue() + done(); + }); + netConn.on('netCapabilitiesChange', (error, value) => { + expect(false).assertTrue() + done(); + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + expect(false).assertTrue() + done(); + }); + netConn.on('netLost', (error, value) => { + expect(false).assertTrue() + done(); + }); + netConn.on('netUnavailable', (error, value) => { + done(); + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail ${error}`); + } + }); + await sleep(DELAY); + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + } + }); + done(); + }); + + /** + * @tc.number Telephony_NetworkManager_register_Async_2100 + * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, + * call Register () to activate the default network ,and see if the callback information is generated + * @tc.desc Function test + */ + it('Telephony_NetworkManager_register_Async_2100', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_register_Async_2100'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [0], + networkCap: [0], + }, bearerPrivateIdentifier: '123' + } + let netId = 0; + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable ` + value); + netId = true; + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail ${error}`); + } + }); + await sleep(DELAY); + expect(true).assertTrue() + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + } + done(); + }); + let netSpecifier1 = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [0], + networkCap: [12], + }, bearerPrivateIdentifier: '123' + } + let netConn1 = connection.createNetConnection(netSpecifier1, TIMEOUT); + netConn1.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + } + }); + netConn1.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn1.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn1.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn1.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + } + }); + netConn1.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable ` + value); + netId = true; + } + }); + netConn1.register((error) => { + if (error) { + console.info(`${caseName} register fail ${error}`); + } + }); + await sleep(DELAY); + expect(true).assertTrue() + netConn1.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + } + done(); + }); + done(); + }); + + /** + * @tc.number Telephony_NetworkManager_register_Async_2200 + * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, + * call Register () to activate the default network ,and see if the callback information is generated + * @tc.desc Function test + */ + it('Telephony_NetworkManager_register_Async_2200', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_register_Async_2200'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [0], + networkCap: [0], + }, bearerPrivateIdentifier: '123' + } + let netId = 0; + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT); + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable ` + value.netId); + netId = true; + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail ${error}`); + } + }); + await sleep(DELAY); + expect(true).assertTrue() + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + } + done(); + }); + let netSpecifier1 = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [1], + networkCap: [12], + }, bearerPrivateIdentifier: '123' + } + let netConn1 = connection.createNetConnection(netSpecifier1, TIMEOUT); + netConn1.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + } + }); + netConn1.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + } + }); + netConn1.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + } + }); + netConn1.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + } + }); + netConn1.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + } + }); + netConn1.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable ` + value.netId); + netId = true; + } + }); + netConn1.register((error) => { + if (error) { + console.info(`${caseName} register fail ${error}`); + } + }); + await sleep(DELAY); + expect(true).assertTrue() + netConn1.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + } + done(); + }); + done(); + }); + + /** + * @tc.number Telephony_NetworkManager_register_Async_2300 + * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, + * call Register () to activate the default network ,and see if the callback information is generated + * @tc.desc Function test + */ + it('Telephony_NetworkManager_register_Async_2300', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_register_Async_2300'; + let netConn = connection.createNetConnection(); + let returnValue = 0; + netConn.on('netAvailable', (value) => { + if (value === undefined) { + console.info(`${caseName} on netAvailable fail`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable` + value.netId); + returnValue = value.netId; + } + }); + netConn.on('netCapabilitiesChange', (value) => { + if (value === undefined) { + console.info(`${caseName} on netCapabilitiesChange fail`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle ` + value.netHandle.netId); + expect(value.netHandle.netId > ETH_100 ).assertTrue(); + } + }); + netConn.on('netConnectionPropertiesChange', (value) => { + if (value === undefined) { + console.info(`${caseName} on netConnectionPropertiesChange fail`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange hdndle` + value.netHandle.netId); + } + }); + netConn.on('netLost', (value) => { + if (error) { + console.info(`${caseName} netLost fail`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail ${error}`); + } + }); + await sleep(DELAY); + console.info(`${caseName} returnValue ` + returnValue); + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + done(); + } + done(); + }); + done(); + }); + + /** + * @tc.number Telephony_NetworkManager_unregister_Async_0100 + * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, + * call Register () to activate the default network ,and see if the callback information is generated + * @tc.desc Function test + */ + it('Telephony_NetworkManager_unregister_Async_0100', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_unregister_Async_0100'; + let netSpecifier = { + netCapabilities: { + linkUpBandwidthKbps: 0, + linkDownBandwidthKbps: 0, + bearerTypes: [0], + networkCap: [0], + }, bearerPrivateIdentifier: '123' + } + let netConn = connection.createNetConnection(netSpecifier, TIMEOUT_1); + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + done(); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + done(); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + done(); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + done(); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + done(); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable ` + value.netId); + done(); + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail ${error}`); + } + }); + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + expect().assertFail(); + done(); + } + + done(); + }); + done(); + }); + + + /** + * @tc.number Telephony_NetworkManager_unregister_Async_0200 + * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, + * call Register () to activate the default network ,and see if the callback information is generated + * @tc.desc Function test + */ + it('Telephony_NetworkManager_unregister_Async_0200', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_unregister_Async_0200'; + let netConn = connection.createNetConnection(); + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + done(); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + done(); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + done(); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + done(); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + done(); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable ` + value.netId); + done(); + } + }); + netConn.register((error) => { + if (error) { + console.info(`${caseName} register fail ${error}`); + } + }); + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + expect().assertFail(); + done(); + } + + done(); + }); + done(); + }); + + /** + * @tc.number Telephony_NetworkManager_unregister_Async_0300 + * @tc.name Enter bearerTypes add networkCap as empty ,set class NetConnection, + * call Register () to activate the default network ,and see if the callback information is generated + * @tc.desc Function test + */ + it('Telephony_NetworkManager_unregister_Async_0300', 0, async function (done) { + let caseName = 'Telephony_NetworkManager_unregister_Async_0300'; + let netConn = connection.createNetConnection(); + netConn.on('netAvailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail: ${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netAvailable : ` + value.netId); + done(); + } + }); + netConn.on('netBlockStatusChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + done(); + } + }); + netConn.on('netCapabilitiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); + done(); + } + }); + netConn.on('netConnectionPropertiesChange', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netConnectionPropertiesChange handle = :` + value.handle.netId); + done(); + } + }); + netConn.on('netLost', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netLost ` + value.netId); + done(); + } + }); + netConn.on('netUnavailable', (error, value) => { + if (error) { + console.info(`${caseName} register fail :${error}`); + expect().assertFail(); + done(); + } else { + console.info(`${caseName} netUnavailable ` + value.netId); + done(); + } + }); + netConn.unregister((error) => { + if (error) { + console.info(`${caseName} unregister result : ${error}`); + expect().assertFail(); + done(); + } + + done(); + }); + done(); + }); + + }); +} + \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/register/src/main/resources/base/element/string.json b/telephony/telephonyjstest/netmanager_base/register/src/main/resources/base/element/string.json new file mode 100644 index 000000000..702c89135 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/register/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Sim Test" + }, + { + "name": "mainability_description", + "value": "Sim Test - sim manager interface test" + }, + { + "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/netmanager_base/network_nopermission/entry/src/main/js/resources/base/media/icon.png b/telephony/telephonyjstest/netmanager_base/register/src/main/resources/base/media/icon.png similarity index 100% rename from telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/resources/base/media/icon.png rename to telephony/telephonyjstest/netmanager_base/register/src/main/resources/base/media/icon.png diff --git a/telephony/telephonyjstest/netmanager_base/system_fetch/BUILD.gn b/telephony/telephonyjstest/netmanager_base/system_fetch/BUILD.gn index eb6e157e3..d8d7d660b 100644 --- a/telephony/telephonyjstest/netmanager_base/system_fetch/BUILD.gn +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/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("ActsSystemFetchTest") { - hap_profile = "./entry/src/main/config.json" + hap_profile = "./src/main/config.json" deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", @@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsSystemFetchTest") { hap_name = "ActsSystemFetchTest" } ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" } ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" } diff --git a/telephony/telephonyjstest/netmanager_base/system_fetch/Test.json b/telephony/telephonyjstest/netmanager_base/system_fetch/Test.json index 3ccd069b6..f74dd6607 100644 --- a/telephony/telephonyjstest/netmanager_base/system_fetch/Test.json +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/Test.json @@ -1,18 +1,20 @@ -{ - "description": "Function test of sim manager interface", - "driver": { - "type": "JSUnitTest", - "test-timeout": "900000", - "package": "com.ohos.system_fetch", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "$module.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} +{ + "description": "Function test of sim manager interface", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "900000", + "bundle-name": "com.ohos.system_fetch", + "package-name": "com.ohos.system_fetch", + "shell-timeout": "900000", + "testcase-timeout": "30000" + }, + "kits": [ + { + "test-file-name": [ + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/resources/base/element/string.json b/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 490210a39..000000000 --- a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "entry_desc", - "value": "description" - }, - { - "name": "MainAbility_desc", - "value": "description" - }, - { - "name": "MainAbility_label", - "value": "label" - } - ] -} \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/resources/base/media/icon.png b/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6790 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 + + {{ $t('strings.hello') }} {{ title }} + + diff --git a/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/default/pages/index/index.js b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/MainAbility/pages/index/index.js similarity index 68% rename from telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/default/pages/index/index.js rename to telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/MainAbility/pages/index/index.js index 7f55040e7..2c2404015 100644 --- a/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/default/pages/index/index.js +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/MainAbility/pages/index/index.js @@ -1,50 +1,43 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import 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 () { + }, }; \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestAbility/app.js b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..e64117c26 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestAbility/app.js @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('TestApplication onCreate'); + }, + onDestroy() { + console.info('TestApplication onDestroy'); + } +}; + diff --git a/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestAbility/i18n/en-US.json b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/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/netmanager_base/system_fetch/src/main/js/TestAbility/i18n/zh-CN.json b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/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/netmanager_base/system_fetch/src/main/js/TestAbility/pages/index/index.css b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 000000000..b1bcd4338 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/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/netmanager_base/system_fetch/src/main/js/TestAbility/pages/index/index.hml b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..f629c71a9 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestAbility/pages/index/index.js b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/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/netmanager_base/system_fetch/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..05ba57825 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/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/netmanager_base/system_fetch/entry/src/main/js/test/Http.fetch.test.js b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/test/Http.fetch.test.js similarity index 96% rename from telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/test/Http.fetch.test.js rename to telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/test/Http.fetch.test.js index bbfd487b8..efb46c82a 100644 --- a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/test/Http.fetch.test.js +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/test/Http.fetch.test.js @@ -1,442 +1,444 @@ - -/** - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License") - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import NetHttp from '@ohos.net.http'; -import fetch from '@system.fetch'; -import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index'; - -describe("Telephony_NetStack_HttpFetchTest", function () { - - /** - * @tc.number Telephony_NetStack_HttpTestBasicGet_0100 - * @tc.name 基本场景,测试能否GET一个网址 - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestBasicGet_0100", 0, function (done) { - let http = NetHttp.createHttp() - http.request("https://httpbin.org/anything").then(function(data){ - console.info("NetStack " + JSON.stringify(data)); - expect(data.responseCode === NetHttp.ResponseCode.OK).assertTrue() - done(); - }) - }); - - /** - * @tc.number Telephony_NetStack_HttpTestUserAgent_0100 - * @tc.name 返回用户代理 - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestUserAgent_0100", 0, function (done) { - let http = NetHttp.createHttp() - http.request("https://httpbin.org/user-agent").then(function(data){ - console.info("NetStack "+ JSON.stringify(data)); - expect(data.responseCode === NetHttp.ResponseCode.OK).assertTrue() - expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue(); - done(); - }) - }); - - /** - * @tc.number Telephony_NetStack_HttpTestHeader_0100 - * @tc.name 返回Header - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestHeader_0100", 0, function (done) { - let http = NetHttp.createHttp() - http.request("https://httpbin.org/headers").then(function(data){ - console.info("NetStack "+ JSON.stringify(data)); - expect(data.responseCode === NetHttp.ResponseCode.OK).assertTrue() - console.info("NetStack "+JSON.stringify(JSON.parse(data.result))) - expect(JSON.parse(data.result)["headers"]["Content-Type"] === "application/json").assertTrue() - done(); - }) - }); - - /** - * @tc.number Telephony_NetStack_HttpTestPost_0100 - * @tc.name 返回Post内容 - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestPost_0100", 0, function (done) { - let http = NetHttp.createHttp() - http.request("https://httpbin.org/post" ,{ - method : NetHttp.RequestMethod.POST, - extraData : "MineMine" - }).then(function(data){ - console.info("NetStack "+JSON.stringify(data)); - expect(data.responseCode === NetHttp.ResponseCode.OK).assertTrue() - expect(JSON.parse(data.result)["data"] === "MineMine").assertTrue() - done(); - }) - }); - - /** - * @tc.number Telephony_NetStack_HttpTestPut_0100 - * @tc.name 返回Put内容 - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestPut_0100", 0, function (done) { - let http = NetHttp.createHttp() - http.request("https://httpbin.org/put" ,{ - method : NetHttp.RequestMethod.PUT, - extraData : "MineMine" - }).then(function(data){ - console.info("NetStack "+JSON.stringify(data)); - expect(data.responseCode === NetHttp.ResponseCode.OK).assertTrue() - expect(JSON.parse(data.result)["data"] === "MineMine").assertTrue() - done(); - }) - }); - - /** - * @tc.number Telephony_NetStack_HttpTestCookies_0100 - * @tc.name 返回Cookies内容 - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestCookies_0100", 0, function (done) { - let http = NetHttp.createHttp() - http.request("https://httpbin.org/cookies/set/name/value").then(function(data){ - console.info("NetStack "+JSON.stringify(data)) - expect(data.responseCode === NetHttp.ResponseCode.OK).assertTrue() - expect(data.cookies !== "").assertTrue() - done(); - }) - }); - - /** - * @tc.number Telephony_NetStack_HttpTestUrlEncode_0100 - * @tc.name 返回Cookies内容 - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestUrlEncode_0100", 0, function (done) { - let http = NetHttp.createHttp() - http.request("https://httpbin.org/response-headers?key1=val1&key2=val2" ,{ - extraData : { - "name1" : "mine1", - "name2" : "mine2", - } - }).then(function(data){ - console.info("NetStack "+JSON.stringify(data)); - expect(data.responseCode === NetHttp.ResponseCode.OK).assertTrue() - expect(JSON.parse(data.result)["key1"] === "val1").assertTrue() - expect(JSON.parse(data.result)["key2"] === "val2").assertTrue() - expect(JSON.parse(data.result)["name1"] === "mine1").assertTrue() - expect(JSON.parse(data.result)["name2"] === "mine2").assertTrue() - done(); - }) - }); - - /** - * @tc.number Telephony_NetStack_HttpTestFetchBasicGet_0100 - * @tc.name 基本场景,FETCH方式测试能否GET一个网址 - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestFetchBasicGet_0100", 0, function (done) { - fetch.fetch({ - url : "https://httpbin.org/anything", - success : function(data){ - console.info("NetStack fetch success "+JSON.stringify(data)) - expect(data.code === 200).assertTrue() - done(); - }, - fail : function(){ - console.info("NetStack Fetch Failed") - expect().assertFail() - done() - }, - complete : function(){ - console.info("NetStack Fetch Complete") - } - }) - }); - - /** - * @tc.number Telephony_NetStack_HttpTestFetchUserAgent_0100 - * @tc.name FETCH方式返回用户代理 - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestFetchUserAgent_0100", 0, function (done) { - fetch.fetch({ - url : "https://httpbin.org/user-agent", - success : function(data){ - console.info("NetStack fetch success "+ JSON.stringify(data)) - expect(data.code === 200).assertTrue() - expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue(); - done(); - }, - fail : function(){ - console.info("NetStack Fetch Failed") - expect().assertFail() - done(); - }, - complete : function(){ - console.info("NetStack fetch complete") - } - }) - }); - - /** - * @tc.number Telephony_NetStack_HttpTestFetchUserAgent_0200 - * @tc.name FETCH方式返回用户代理 - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestFetchUserAgent_0200", 0, function (done) { - fetch.fetch({ - url : "https://httpbin.org/user-agent", - responseType : "JSON", - success : function(data){ - console.info("NetStack fetch success "+ JSON.stringify(data)) - expect(data.code === 200).assertTrue() - expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue(); - done(); - }, - fail : function(){ - console.info("NetStack Fetch Failed") - expect().assertFail() - done(); - }, - complete : function(){ - console.info("NetStack fetch complete") - } - }) - }); - - /** - * @tc.number Telephony_NetStack_HttpTestFetchHeader_0100 - * @tc.name 返回Header - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestFetchHeader_0100", 0, function (done) { - fetch.fetch({ - url : "https://httpbin.org/headers", - success : function(data){ - console.info("NetStack Fetch Success "+ JSON.stringify(data)) - expect(data.code === 200).assertTrue() - expect(JSON.parse(data.data)["headers"]["Content-Type"] === "application/json").assertTrue() - done(); - }, - fail : function(){ - console.info("NetStack Fetch Failed") - expect().assertFail() - done(); - }, - complete : function(){ - console.info("NetStack Fetch Complete") - } - }) - }); - - /** - * @tc.number Telephony_NetStack_HttpTestFetchHeader_0200 - * @tc.name 返回Header - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestFetchHeader_0200", 0, function (done) { - fetch.fetch({ - url : "https://httpbin.org/headers", - responseType : "JSON", - success : function(data){ - console.info("NetStack Fetch Success "+ JSON.stringify(data)) - expect(data.code === 200).assertTrue() - expect(data.data["headers"]["Content-Type"] === "application/json").assertTrue() - done(); - }, - fail : function(){ - console.info("NetStack Fetch Failed") - expect().assertFail() - done(); - }, - complete : function(){ - console.info("NetStack Fetch Complete") - } - }) - }); - - /** - * @tc.number Telephony_NetStack_HttpTestFetchPost_0100 - * @tc.name 返回Post内容 - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestFetchPost_0100", 0, function (done) { - fetch.fetch({ - url : "https://httpbin.org/post", - method : "POST", - data : "MineMine", - success : function(data){ - console.info("NetStack "+ JSON.stringify(data)) - expect(data.code === 200).assertTrue() - expect(JSON.parse(data.data)["data"] === "MineMine").assertTrue() - done(); - }, - fail : function(){ - console.info("NetStack Fetch Failed") - expect().assertFail() - done() - }, - complete : function(){ - console.info("NetStack Fetch Complete") - } - }) - }); - - /** - * @tc.number Telephony_NetStack_HttpTestFetchPost_0200 - * @tc.name 返回Post内容 - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestFetchPost_0200", 0, function (done) { - fetch.fetch({ - url : "https://httpbin.org/post", - method : "POST", - data : "MineMine", - responseType : "JSON", - success : function(data){ - console.info("NetStack "+ JSON.stringify(data)) - expect(data.code === 200).assertTrue() - expect(data.data["data"] === "MineMine").assertTrue() - done(); - }, - fail : function(){ - console.info("NetStack Fetch Failed") - expect().assertFail() - done(); - }, - complete : function(){ - console.info("NetStack Fetch Complete") - } - }) - }); - - /** - * @tc.number Telephony_NetStack_HttpTestFetchPut_0100 - * @tc.name 返回Put内容 - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestFetchPut_0100", 0, function (done) { - fetch.fetch({ - url : "https://httpbin.org/put", - method : "PUT", - data : "MineMine", - success : function(data){ - console.info("NetStack "+ JSON.stringify(data)) - expect(data.code === 200).assertTrue() - expect(JSON.parse(data.data)["data"] === "MineMine").assertTrue() - done(); - }, - fail : function(){ - console.info("NetStack Fetch Failed") - expect().assertFail() - done(); - }, - complete : function(){ - console.info("NetStack Fetch Complete") - } - }) - }); - - /** - * @tc.number Telephony_NetStack_HttpTestFetchPut_0200 - * @tc.name 返回Put内容 - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestFetchPut_0200", 0, function (done) { - fetch.fetch({ - url : "https://httpbin.org/put", - method : "PUT", - data : "MineMine", - responseType : "JSON", - success : function(data){ - console.info("NetStack "+ JSON.stringify(data)) - expect(data.code === 200).assertTrue() - expect(data.data["data"] === "MineMine").assertTrue() - done(); - }, - fail : function(){ - console.info("NetStack Fetch Failed") - expect().assertFail() - done(); - }, - complete : function(){ - console.info("NetStack Fetch Complete") - } - }) - }); - - /** - * @tc.number Telephony_NetStack_HttpTestFetchUrlEncode_0100 - * @tc.name 返回Cookies内容 - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestFetchUrlEncode_0100", 0, function (done) { - fetch.fetch({ - url : "https://httpbin.org/response-headers?key1=val1&key2=val2", - data : { - "name1" : "mine1", - "name2" : "mine2", - }, - success : function(data){ - console.info("NetStack "+JSON.stringify(data)) - expect(data.code === 200).assertTrue() - expect(JSON.parse(data.data)["key1"] === "val1").assertTrue() - expect(JSON.parse(data.data)["key2"] === "val2").assertTrue() - expect(JSON.parse(data.data)["name1"] === "mine1").assertTrue() - expect(JSON.parse(data.data)["name2"] === "mine2").assertTrue() - done(); - }, - fail : function(){ - console.info("NetStack Fetch Failed") - expect().assertFail() - done() - }, - complete : function(){ - console.info("NetStack Fetch Complete") - } - }) - }); - - /** - * @tc.number Telephony_NetStack_HttpTestFetchUrlEncode_0200 - * @tc.name 返回Cookies内容 - * @tc.desc function test - */ - it("Telephony_NetStack_HttpTestFetchUrlEncode_0200", 0, function (done) { - fetch.fetch({ - url : "https://httpbin.org/response-headers?key1=val1&key2=val2", - data : { - "name1" : "mine1", - "name2" : "mine2", - }, - responseType : "JSON", - success : function(data){ - console.info("NetStack "+JSON.stringify(data)) - expect(data.code === 200).assertTrue() - expect(data.data["key1"] === "val1").assertTrue() - expect(data.data["key2"] === "val2").assertTrue() - expect(data.data["name1"] === "mine1").assertTrue() - expect(data.data["name2"] === "mine2").assertTrue() - done(); - }, - fail : function(){ - console.info("NetStack Fetch Failed") - expect().assertFail() - done() - }, - complete : function(){ - console.info("NetStack Fetch Complete") - } - }) - }); -}); \ 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 NetHttp from '@ohos.net.http'; +import fetch from '@system.fetch'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +export default function Telephony_NetStack_HttpFetchTest() { + +describe("Telephony_NetStack_HttpFetchTest", function () { + + /** + * @tc.number Telephony_NetStack_HttpTestBasicGet_0100 + * @tc.name 基本场景,测试能否GET一个网址 + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestBasicGet_0100", 0, function (done) { + let http = NetHttp.createHttp() + http.request("https://httpbin.org/anything").then(function(data){ + console.info("NetStack " + JSON.stringify(data)); + expect(data.responseCode === NetHttp.ResponseCode.OK).assertTrue() + done(); + }) + }); + + /** + * @tc.number Telephony_NetStack_HttpTestUserAgent_0100 + * @tc.name 返回用户代理 + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestUserAgent_0100", 0, function (done) { + let http = NetHttp.createHttp() + http.request("https://httpbin.org/user-agent").then(function(data){ + console.info("NetStack "+ JSON.stringify(data)); + expect(data.responseCode === NetHttp.ResponseCode.OK).assertTrue() + expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue(); + done(); + }) + }); + + /** + * @tc.number Telephony_NetStack_HttpTestHeader_0100 + * @tc.name 返回Header + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestHeader_0100", 0, function (done) { + let http = NetHttp.createHttp() + http.request("https://httpbin.org/headers").then(function(data){ + console.info("NetStack "+ JSON.stringify(data)); + expect(data.responseCode === NetHttp.ResponseCode.OK).assertTrue() + console.info("NetStack "+JSON.stringify(JSON.parse(data.result))) + expect(JSON.parse(data.result)["headers"]["Content-Type"] === "application/json").assertTrue() + done(); + }) + }); + + /** + * @tc.number Telephony_NetStack_HttpTestPost_0100 + * @tc.name 返回Post内容 + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestPost_0100", 0, function (done) { + let http = NetHttp.createHttp() + http.request("https://httpbin.org/post" ,{ + method : NetHttp.RequestMethod.POST, + extraData : "MineMine" + }).then(function(data){ + console.info("NetStack "+JSON.stringify(data)); + expect(data.responseCode === NetHttp.ResponseCode.OK).assertTrue() + expect(JSON.parse(data.result)["data"] === "MineMine").assertTrue() + done(); + }) + }); + + /** + * @tc.number Telephony_NetStack_HttpTestPut_0100 + * @tc.name 返回Put内容 + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestPut_0100", 0, function (done) { + let http = NetHttp.createHttp() + http.request("https://httpbin.org/put" ,{ + method : NetHttp.RequestMethod.PUT, + extraData : "MineMine" + }).then(function(data){ + console.info("NetStack "+JSON.stringify(data)); + expect(data.responseCode === NetHttp.ResponseCode.OK).assertTrue() + expect(JSON.parse(data.result)["data"] === "MineMine").assertTrue() + done(); + }) + }); + + /** + * @tc.number Telephony_NetStack_HttpTestCookies_0100 + * @tc.name 返回Cookies内容 + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestCookies_0100", 0, function (done) { + let http = NetHttp.createHttp() + http.request("https://httpbin.org/cookies/set/name/value").then(function(data){ + console.info("NetStack "+JSON.stringify(data)) + expect(data.responseCode === NetHttp.ResponseCode.OK).assertTrue() + expect(data.cookies !== "").assertTrue() + done(); + }) + }); + + /** + * @tc.number Telephony_NetStack_HttpTestUrlEncode_0100 + * @tc.name 返回Cookies内容 + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestUrlEncode_0100", 0, function (done) { + let http = NetHttp.createHttp() + http.request("https://httpbin.org/response-headers?key1=val1&key2=val2" ,{ + extraData : { + "name1" : "mine1", + "name2" : "mine2", + } + }).then(function(data){ + console.info("NetStack "+JSON.stringify(data)); + expect(data.responseCode === NetHttp.ResponseCode.OK).assertTrue() + expect(JSON.parse(data.result)["key1"] === "val1").assertTrue() + expect(JSON.parse(data.result)["key2"] === "val2").assertTrue() + expect(JSON.parse(data.result)["name1"] === "mine1").assertTrue() + expect(JSON.parse(data.result)["name2"] === "mine2").assertTrue() + done(); + }) + }); + + /** + * @tc.number Telephony_NetStack_HttpTestFetchBasicGet_0100 + * @tc.name 基本场景,FETCH方式测试能否GET一个网址 + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestFetchBasicGet_0100", 0, function (done) { + fetch.fetch({ + url : "https://httpbin.org/anything", + success : function(data){ + console.info("NetStack fetch success "+JSON.stringify(data)) + expect(data.code === 200).assertTrue() + done(); + }, + fail : function(){ + console.info("NetStack Fetch Failed") + expect().assertFail() + done() + }, + complete : function(){ + console.info("NetStack Fetch Complete") + } + }) + }); + + /** + * @tc.number Telephony_NetStack_HttpTestFetchUserAgent_0100 + * @tc.name FETCH方式返回用户代理 + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestFetchUserAgent_0100", 0, function (done) { + fetch.fetch({ + url : "https://httpbin.org/user-agent", + success : function(data){ + console.info("NetStack fetch success "+ JSON.stringify(data)) + expect(data.code === 200).assertTrue() + expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue(); + done(); + }, + fail : function(){ + console.info("NetStack Fetch Failed") + expect().assertFail() + done(); + }, + complete : function(){ + console.info("NetStack fetch complete") + } + }) + }); + + /** + * @tc.number Telephony_NetStack_HttpTestFetchUserAgent_0200 + * @tc.name FETCH方式返回用户代理 + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestFetchUserAgent_0200", 0, function (done) { + fetch.fetch({ + url : "https://httpbin.org/user-agent", + responseType : "JSON", + success : function(data){ + console.info("NetStack fetch success "+ JSON.stringify(data)) + expect(data.code === 200).assertTrue() + expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue(); + done(); + }, + fail : function(){ + console.info("NetStack Fetch Failed") + expect().assertFail() + done(); + }, + complete : function(){ + console.info("NetStack fetch complete") + } + }) + }); + + /** + * @tc.number Telephony_NetStack_HttpTestFetchHeader_0100 + * @tc.name 返回Header + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestFetchHeader_0100", 0, function (done) { + fetch.fetch({ + url : "https://httpbin.org/headers", + success : function(data){ + console.info("NetStack Fetch Success "+ JSON.stringify(data)) + expect(data.code === 200).assertTrue() + expect(JSON.parse(data.data)["headers"]["Content-Type"] === "application/json").assertTrue() + done(); + }, + fail : function(){ + console.info("NetStack Fetch Failed") + expect().assertFail() + done(); + }, + complete : function(){ + console.info("NetStack Fetch Complete") + } + }) + }); + + /** + * @tc.number Telephony_NetStack_HttpTestFetchHeader_0200 + * @tc.name 返回Header + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestFetchHeader_0200", 0, function (done) { + fetch.fetch({ + url : "https://httpbin.org/headers", + responseType : "JSON", + success : function(data){ + console.info("NetStack Fetch Success "+ JSON.stringify(data)) + expect(data.code === 200).assertTrue() + expect(data.data["headers"]["Content-Type"] === "application/json").assertTrue() + done(); + }, + fail : function(){ + console.info("NetStack Fetch Failed") + expect().assertFail() + done(); + }, + complete : function(){ + console.info("NetStack Fetch Complete") + } + }) + }); + + /** + * @tc.number Telephony_NetStack_HttpTestFetchPost_0100 + * @tc.name 返回Post内容 + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestFetchPost_0100", 0, function (done) { + fetch.fetch({ + url : "https://httpbin.org/post", + method : "POST", + data : "MineMine", + success : function(data){ + console.info("NetStack "+ JSON.stringify(data)) + expect(data.code === 200).assertTrue() + expect(JSON.parse(data.data)["data"] === "MineMine").assertTrue() + done(); + }, + fail : function(){ + console.info("NetStack Fetch Failed") + expect().assertFail() + done() + }, + complete : function(){ + console.info("NetStack Fetch Complete") + } + }) + }); + + /** + * @tc.number Telephony_NetStack_HttpTestFetchPost_0200 + * @tc.name 返回Post内容 + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestFetchPost_0200", 0, function (done) { + fetch.fetch({ + url : "https://httpbin.org/post", + method : "POST", + data : "MineMine", + responseType : "JSON", + success : function(data){ + console.info("NetStack "+ JSON.stringify(data)) + expect(data.code === 200).assertTrue() + expect(data.data["data"] === "MineMine").assertTrue() + done(); + }, + fail : function(){ + console.info("NetStack Fetch Failed") + expect().assertFail() + done(); + }, + complete : function(){ + console.info("NetStack Fetch Complete") + } + }) + }); + + /** + * @tc.number Telephony_NetStack_HttpTestFetchPut_0100 + * @tc.name 返回Put内容 + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestFetchPut_0100", 0, function (done) { + fetch.fetch({ + url : "https://httpbin.org/put", + method : "PUT", + data : "MineMine", + success : function(data){ + console.info("NetStack "+ JSON.stringify(data)) + expect(data.code === 200).assertTrue() + expect(JSON.parse(data.data)["data"] === "MineMine").assertTrue() + done(); + }, + fail : function(){ + console.info("NetStack Fetch Failed") + expect().assertFail() + done(); + }, + complete : function(){ + console.info("NetStack Fetch Complete") + } + }) + }); + + /** + * @tc.number Telephony_NetStack_HttpTestFetchPut_0200 + * @tc.name 返回Put内容 + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestFetchPut_0200", 0, function (done) { + fetch.fetch({ + url : "https://httpbin.org/put", + method : "PUT", + data : "MineMine", + responseType : "JSON", + success : function(data){ + console.info("NetStack "+ JSON.stringify(data)) + expect(data.code === 200).assertTrue() + expect(data.data["data"] === "MineMine").assertTrue() + done(); + }, + fail : function(){ + console.info("NetStack Fetch Failed") + expect().assertFail() + done(); + }, + complete : function(){ + console.info("NetStack Fetch Complete") + } + }) + }); + + /** + * @tc.number Telephony_NetStack_HttpTestFetchUrlEncode_0100 + * @tc.name 返回Cookies内容 + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestFetchUrlEncode_0100", 0, function (done) { + fetch.fetch({ + url : "https://httpbin.org/response-headers?key1=val1&key2=val2", + data : { + "name1" : "mine1", + "name2" : "mine2", + }, + success : function(data){ + console.info("NetStack "+JSON.stringify(data)) + expect(data.code === 200).assertTrue() + expect(JSON.parse(data.data)["key1"] === "val1").assertTrue() + expect(JSON.parse(data.data)["key2"] === "val2").assertTrue() + expect(JSON.parse(data.data)["name1"] === "mine1").assertTrue() + expect(JSON.parse(data.data)["name2"] === "mine2").assertTrue() + done(); + }, + fail : function(){ + console.info("NetStack Fetch Failed") + expect().assertFail() + done() + }, + complete : function(){ + console.info("NetStack Fetch Complete") + } + }) + }); + + /** + * @tc.number Telephony_NetStack_HttpTestFetchUrlEncode_0200 + * @tc.name 返回Cookies内容 + * @tc.desc function test + */ + it("Telephony_NetStack_HttpTestFetchUrlEncode_0200", 0, function (done) { + fetch.fetch({ + url : "https://httpbin.org/response-headers?key1=val1&key2=val2", + data : { + "name1" : "mine1", + "name2" : "mine2", + }, + responseType : "JSON", + success : function(data){ + console.info("NetStack "+JSON.stringify(data)) + expect(data.code === 200).assertTrue() + expect(data.data["key1"] === "val1").assertTrue() + expect(data.data["key2"] === "val2").assertTrue() + expect(data.data["name1"] === "mine1").assertTrue() + expect(data.data["name2"] === "mine2").assertTrue() + done(); + }, + fail : function(){ + console.info("NetStack Fetch Failed") + expect().assertFail() + done() + }, + complete : function(){ + console.info("NetStack Fetch Complete") + } + }) + }); +}); +} \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/test/List.test.js b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/test/List.test.js similarity index 78% rename from telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/test/List.test.js rename to telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/test/List.test.js index f665f7955..0b00ef6b0 100644 --- a/telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/js/test/List.test.js +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/test/List.test.js @@ -1,16 +1,19 @@ -/** - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -require('./Http.nopermission.test.js'); +/** + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import Telephony_NetStack_HttpFetchTest from './Http.fetch.test.js' + + export default function testsuite() { + Telephony_NetStack_HttpFetchTest() + } \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/resources/base/element/string.json b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/resources/base/element/string.json new file mode 100644 index 000000000..0f5ed415f --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "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/netmanager_base/network_nopermission/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/resources/base/media/icon.png similarity index 100% rename from telephony/telephonyjstest/netmanager_base/network_nopermission/entry/src/main/resources/base/media/icon.png rename to telephony/telephonyjstest/netmanager_base/system_fetch/src/main/resources/base/media/icon.png -- GitLab