提交 0301632c 编写于 作者: G gaoxi

电话用例修改

Signed-off-by: Ngaoxi <gaoxi785@huawei.com>
上级 30547c2b
......@@ -19,8 +19,12 @@ group("netmanager_base") {
deps = [
"dns:ActsDNSTest",
"jshttp:ActsJSHTTPTest",
"network_nopermission:ActsNetworkNopermissionTest",
"network_nowifi:ActsNetworkNowifiTest",
"network_wifi:ActsNetworkWifiTest",
"register:ActsRegisterTest",
"socket:ActsSocketTest",
"system_fetch:ActsSystemFetchTest",
]
}
}
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsNetworkNopermissionTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsNetworkNopermissionTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Function test of sim manager interface",
"driver": {
"type": "JSUnitTest",
"test-timeout": "1800000",
"package": "com.ohos.network_nopermission",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"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": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
export default {
onCreate() {
console.info("Application onCreate");
},
onDestroy() {
console.info("Application onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.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
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import app from '@system.app';
import device from '@system.device';
import router from '@system.router';
import {Core, ExpectExtend} from 'deccjsunit/index';
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ''
},
onInit () {
this.title = this.$t('strings.world');
},
onShow () {
console.info('onShow finish!');
const core = Core.getInstance();
const expectExtend = new ExpectExtend({
'id': 'extend'
});
core.addService('expect', expectExtend);
core.init();
const configService = core.getDefaultService('config');
this.timeout = 30000
configService.setConfig(this);
require('../../../test/List.test');
core.execute();
},
onReady () {
},
};
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ 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 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.
*/
require('./Http.nopermission.test.js');
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsNetworkNowifiTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsNetworkNowifiTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Function test of sim manager interface",
"driver": {
"type": "JSUnitTest",
"test-timeout": "1800000",
"package": "com.ohos.network_nowifi",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"vendor": "ohos",
"bundleName": "com.ohos.network_nowifi",
"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": ".MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"launchType": "standard"
}
],
"reqPermissions": [
{
"name":"ohos.permission.GET_NETWORK_INFO",
"reason":"need use ohos.permission.GET_NETWORK_INFO"
}
],
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "com.ohos.network_nowifi",
"srcPath": "",
"name": ".entry",
"js": [
{
"pages": [
"pages/index/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
export default {
onCreate() {
console.info("Application onCreate");
},
onDestroy() {
console.info("Application onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.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
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import app from '@system.app';
import device from '@system.device';
import router from '@system.router';
import {Core, ExpectExtend} from 'deccjsunit/index';
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ''
},
onInit () {
this.title = this.$t('strings.world');
},
onShow () {
console.info('onShow finish!');
const core = Core.getInstance();
const expectExtend = new ExpectExtend({
'id': 'extend'
});
core.addService('expect', expectExtend);
core.init();
const configService = core.getDefaultService('config');
this.timeout = 30000
configService.setConfig(this);
require('../../../test/List.test');
core.execute();
},
onReady () {
},
};
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ 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 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_None_0100
* @tc.name Whether the GetType method is called successfully without WiFi
* @tc.desc Function test
*/
it("Telephony_NetManager_NetWorkTest_GetType_None_0100", 0, function (done) {
network.getType({
success: function (data) {
console.info("NetManager getType " + JSON.stringify(data))
expect(data.type === "none").assertTrue()
expect(data.metered === false).assertTrue()
network.unsubscribe()
done();
},
fail: function (data, code) {
expect().assertFail();
done();
},
complete: function () {
expect().assertTrue()
done();
}
})
done();
});
/**
* @tc.number Telephony_NetManager_NetWorkTest_GetType_None_0200
* @tc.name Whether to call GetType method again without WiFi
* @tc.desc Function test
*/
it("Telephony_NetManager_NetWorkTest_GetType_None_0200", 0, function (done) {
network.getType({
success: function (data) {
console.info("NetManager getType 1 " + JSON.stringify(data))
expect(data.type === "none").assertTrue()
expect(data.metered === false).assertTrue()
network.unsubscribe()
done();
console.info("NetManager Telephony_NetManager_NetWorkTest_GetType_none_1 end")
},
fail: function (data, code) {
expect().assertFail();
done();
},
complete: function () {
expect().assertTrue()
done();
}
})
done();
});
/**
* @tc.number Telephony_NetManager_NetWorkTest_Subscribe_None_0100
* @tc.name Whether the subscribe method is called successfully without WiFi
* @tc.desc Function test
*/
it("Telephony_NetManager_NetWorkTest_Subscribe_None_0100", 0, function (done) {
network.subscribe({
success: function (data) {
console.info("NetManager subscribe " + JSON.stringify(data))
expect(data.type === "none").assertTrue()
expect(data.metered === false).assertTrue()
network.unsubscribe()
done();
},
fail: function (data, code) {
expect().assertFail()
done();
}
})
done();
});
/**
* @tc.number Telephony_NetManager_NetWorkTest_Subscribe_None_0200
* @tc.name Whether to call the subscribe method again without WiFi
* @tc.desc Function test
*/
it("Telephony_NetManager_NetWorkTest_Subscribe_None_0200", 0, function (done) {
network.subscribe({
success: function (data) {
console.info("NetManager subscribe " + JSON.stringify(data))
expect(data.type === "none").assertTrue()
expect(data.metered === false).assertTrue()
network.unsubscribe()
done();
},
fail: function (data, code) {
expect().assertFail()
done();
}
})
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.
*/
require('./Http.nowifi.test');
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsNetworkWifiTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsNetworkWifiTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Function test of sim manager interface",
"driver": {
"type": "JSUnitTest",
"test-timeout": "1800000",
"package": "com.ohos.network_wifi",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"vendor": "ohos",
"bundleName": "com.ohos.network_wifi",
"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": ".MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"launchType": "standard"
}
],
"reqPermissions": [
{
"name":"ohos.permission.GET_NETWORK_INFO",
"reason":"need use ohos.permission.GET_NETWORK_INFO"
}
],
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "com.ohos.network_wifi",
"srcPath": "",
"name": ".entry",
"js": [
{
"pages": [
"pages/index/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
export default {
onCreate() {
console.info("Application onCreate");
},
onDestroy() {
console.info("Application onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.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
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import app from '@system.app';
import device from '@system.device';
import router from '@system.router';
import {Core, ExpectExtend} from 'deccjsunit/index';
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ''
},
onInit () {
this.title = this.$t('strings.world');
},
onShow () {
console.info('onShow finish!');
const core = Core.getInstance();
const expectExtend = new ExpectExtend({
'id': 'extend'
});
core.addService('expect', expectExtend);
core.init();
const configService = core.getDefaultService('config');
this.timeout = 30000
configService.setConfig(this);
require('../../../test/List.test');
core.execute();
},
onReady () {
},
};
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ 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 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_WiFi_0100
* @tc.name Whether the GetType method is called successfully with WiFi
* @tc.desc Function test
*/
it("Telephony_NetManager_NetWorkTest_GetType_WiFi_0100", 0, function (done) {
network.getType({
success : function(data){
console.info("NetManager getType "+ JSON.stringify(data))
expect(data.type === "WiFi").assertTrue()
expect(data.metered === false).assertTrue()
network.unsubscribe()
done();
},
fail : function(data,code){
expect().assertFail()
done();
},
complete : function(){
expect().assertTrue()
done();
}
})
done();
});
/**
* @tc.number Telephony_NetManager_NetWorkTest_GetType_WiFi_0200
* @tc.name Whether to call GetType method again with WiFi
* @tc.desc Function test
*/
it("Telephony_NetManager_NetWorkTest_GetType_WiFi_0200", 0, function (done) {
network.getType({
success : function(data){
console.info("NetManager getType "+ JSON.stringify(data))
expect(data.type === "WiFi").assertTrue()
expect(data.metered === false).assertTrue()
network.unsubscribe()
done();
console.info("Telephony_NetManager_NetWorkTest_GetType_wifi_1 end")
},
fail : function(data,code){
expect().assertFail()
done();
},
complete : function(){
expect().assertTrue()
done();
}
})
done();
});
/**
* @tc.number Telephony_NetManager_NetWorkTest_Subscribe_WiFi_0100
* @tc.name Whether the subscribe method is called successfully with WiFi
* @tc.desc Function test
*/
it("Telephony_NetManager_NetWorkTest_Subscribe_WiFi_0100", 0, function (done) {
network.subscribe({
success : function(data){
console.info("NetManager subscribe "+JSON.stringify(data))
expect(data.type === "WiFi").assertTrue()
expect(data.metered === false).assertTrue()
network.unsubscribe()
done();
},
fail : function(data,code){
expect().assertFail()
done();
}
})
done();
});
/**
* @tc.number Telephony_NetManager_NetWorkTest_Subscribe_WiFi_0200
* @tc.name Whether to call the subscribe method again with WiFi
* @tc.desc Function test
*/
it("Telephony_NetManager_NetWorkTest_Subscribe_WiFi_0200", 0, function (done) {
network.subscribe({
success : function(data){
console.info("NetManager subscribe 1 "+JSON.stringify(data))
expect(data.type === "WiFi").assertTrue()
expect(data.metered === false).assertTrue()
network.unsubscribe()
done();
},
fail : function(data,code){
expect().assertFail()
done();
}
})
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.
*/
require('./Http.wifi.test');
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsSystemFetchTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsSystemFetchTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Function test of sim manager interface",
"driver": {
"type": "JSUnitTest",
"test-timeout": "1800000",
"package": "com.ohos.system_fetch",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"vendor": "ohos",
"bundleName": "com.ohos.system_fetch",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Release"
}
},
"deviceConfig": {},
"module": {
"mainAbility": ".MainAbility",
"deviceType": [
"phone",
"tablet"
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": ".MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"launchType": "standard"
}
],
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "com.ohos.system_fetch",
"srcPath": "",
"name": ".MyApplication",
"js": [
{
"pages": [
"pages/index/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
export default {
onCreate() {
console.info("Application onCreate");
},
onDestroy() {
console.info("Application onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.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
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import app from '@system.app';
import device from '@system.device';
import router from '@system.router';
import {Core, ExpectExtend} from 'deccjsunit/index';
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ''
},
onInit () {
this.title = this.$t('strings.world');
},
onShow () {
console.info('onShow finish!');
const core = Core.getInstance();
const expectExtend = new ExpectExtend({
'id': 'extend'
});
core.addService('expect', expectExtend);
core.init();
const configService = core.getDefaultService('config');
this.timeout = 30000
configService.setConfig(this);
require('../../../test/List.test');
core.execute();
},
onReady () {
},
};
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ 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, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index';
describe("Telephony_NetStack_HttpTest", 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.data)["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(data.data["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.
*/
require('./Http.fetch.test.js');
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
......@@ -194,12 +194,12 @@ export default function radioSecondJsunit() {
console.log("-----------------------Telephony_Radio_CdmaCellInformation_sid_0100 end-----------------------");
})
/**
* @tc.number Telephony_NetworkSearch_getRadioTech_Async_0500
* @tc.name TestGetRadioTech_500
* @tc.desc Test getRadioTech() api by callback, SlotId parameter input is 0
*/
it('Telephony_NetworkSearch_getRadioTech_Async_0500', 0, async function (done) {
/**
* @tc.number Telephony_NetworkSearch_getRadioTech_Async_0500
* @tc.name TestGetRadioTech_0500
* @tc.desc Test getRadioTech() api by callback .SlotId parameter input is 0
*/
it("Telephony_NetworkSearch_getRadioTech_Async_0500", 0, async function(done){
radio.getRadioTech(0, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_getRadioTech_Async_0500 fail err: ${err}`);
......@@ -213,23 +213,22 @@ export default function radioSecondJsunit() {
});
});
/**
* @tc.number Telephony_NetworkSearch_getRadioTech_Async_0600
* @tc.name testGetRadioTech_0600
* @tc.desc SlotId parameter input is 0, test getRadioTech() api by promise.
*/
it('Telephony_NetworkSearch_getRadioTech_Promise_0500', 0, async function (done) {
/**
* @tc.number Telephony_NetworkSearch_getRadioTech_Promise_0500
* @tc.name TestGetRadioTech_0500
* @tc.desc SlotId parameter input is 0 ,Test getRadioTech() api by promise
*/
it("Telephony_NetworkSearch_getRadioTech_Promise_0500", 0, async function(done){
try {
let data = await radio.getRadioTech(0);
console.log('Telephony_NetworkSearch_getRadioTech_Promise_0500 success');
console.log(`Telephony_NetworkSearch_getRadioTech_Promise_0500 success`);
expect(true).assertTrue();
} catch (err) {
console.log(`Telephony_NetworkSearch_getRadioTech_Promise_0500 fail err: ${err}`);
expect().assertFail();
expect(err.code === '-1').assertTrue();
done();
return;
}
done();
});
/**
......
......@@ -256,46 +256,7 @@ describe('SimManagerTest', function () {
expect().assertFail();
console.log(`${CASE_NAME} fail, data = ${data}`);
done();
});
/**
* @tc.number Telephony_Sim_getDefaultVoiceSlotId_Async_0200
* @tc.name The test first sets the default card number and then calls
* the getDefaultVoiceLotid interface to get the SIM ID.
* @tc.desc Function test
*/
it('Telephony_Sim_getDefaultVoiceSlotId_Async_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getDefaultVoiceSlotId_Async_0200';
sim.getDefaultVoiceSlotId((err, data) => {
if (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
done();
return;
}
expect(data === 0 || data === 1).assertTrue();
done();
});
});
/**
* @tc.number Telephony_Sim_getDefaultVoiceSlotId_Promise_0200
* @tc.name The test first sets the default card number and then calls
* the getDefaultVoiceLotid interface to get the default SIM ID.
* @tc.desc Function test
*/
it('Telephony_Sim_getDefaultVoiceSlotId_Promise_0200', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_getDefaultVoiceSlotId_Promise_0200';
try {
let data = await sim.getDefaultVoiceSlotId();
console.log(`${CASE_NAME}, data = ${data}`);
expect(data === 0 || data === 1).assertTrue();
} catch (err) {
console.log(`${CASE_NAME} expect err: ${err.message}`);
console.log(`${CASE_NAME} finish`);
}
done();
});
});
/**
* @tc.number Telephony_Sim_isSimActive_Async_0700
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册