Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
22dbef13
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
22dbef13
编写于
7月 19, 2023
作者:
O
openharmony_ci
提交者:
Gitee
7月 19, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9390 增加statistic接口用例
Merge pull request !9390 from 高曦/master
上级
054c36d5
2052e395
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
748 addition
and
46 deletion
+748
-46
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/List.test.ets
...est/netmanager_http/entry/src/main/ets/test/List.test.ets
+3
-1
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/StatisticsTest.test.ets
...ager_http/entry/src/main/ets/test/StatisticsTest.test.ets
+744
-0
telephony/telephonyjstest/network_search/network_search_errors/src/main/js/test/NetworkSearchErrors.test.js
...earch_errors/src/main/js/test/NetworkSearchErrors.test.js
+1
-45
未找到文件。
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/List.test.ets
浏览文件 @
22dbef13
/**
* Copyright (c) 2021-202
2
Huawei Device Co., Ltd.
* Copyright (c) 2021-202
3
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
...
...
@@ -19,6 +19,7 @@ import requestMethodJsunit from './RequestMethodJsunit.test';
import httpResponseJsunit from './HttpResponseJsunit.test';
import HttpRequestOptionsJsunit from './HttpRequestOptionsJsunit.test';
import httpRequestJsunit from './HttpRequestJsunit.test';
import StatisticsTest from './StatisticsTest.test';
export default function testsuite() {
httpJsunit();
...
...
@@ -27,4 +28,5 @@ export default function testsuite() {
httpResponseJsunit();
HttpRequestOptionsJsunit();
httpRequestJsunit();
StatisticsTest();
}
\ No newline at end of file
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/StatisticsTest.test.ets
0 → 100644
浏览文件 @
22dbef13
/*
* Copyright (C) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http:www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe,it, expect} from '@ohos/hypium';
import statistics from '@ohos.net.statistics';
import sim from '@ohos.telephony.sim';
import radio from '@ohos.telephony.radio';
export default function StatisticsTest() {
describe("StatisticsTest", function () {
let delayTime = 5000;
const DATA_0 = 0;
let code_201 = 201;
let errCode_201 = "201";
/**
* @tc.number Telephony_NetworkManager_getIfaceRxBytes_Async_0100
* @tc.name Test getIfaceRxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getIfaceRxBytes_Async_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getIfaceRxBytes_Async_0100';
let ifaceName = "eth0";
statistics.getIfaceRxBytes(ifaceName, (err, data) => {
if (err) {
console.log(`${caseName} getIfaceRxBytes fail ${JSON.stringify(err)} `);
done();
} else {
console.log(`${caseName} getIfaceRxBytes ${JSON.stringify(data)}`);
expect().assertFail();
done();
}
});
});
/**
* @tc.number Telephony_NetworkManager_getIfaceRxBytes_Async_0200
* @tc.name Test getIfaceRxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getIfaceRxBytes_Async_0200', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getIfaceRxBytes_Async_0200';
let ifaceName = "wlan0";
statistics.getIfaceRxBytes(ifaceName, (err, data) => {
if (err) {
console.log(`${caseName} getIfaceRxBytes fail ${JSON.stringify(err)} `);
expect().assertFail();
done();
} else {
console.log(`${caseName} getIfaceRxBytes success ${JSON.stringify(data)}`);
expect(data >= DATA_0).assertTrue();
done();
}
});
});
/**
* @tc.number Telephony_NetworkManager_getIfaceRxBytes_Async_0300
* @tc.name Test getIfaceRxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getIfaceRxBytes_Async_0300', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getIfaceRxBytes_Async_0300';
let ifaceName = "wlan1";
statistics.getIfaceRxBytes(ifaceName, (err, data) => {
if (err) {
console.log(`${caseName} getIfaceRxBytes fail ${JSON.stringify(err)} `);
done();
} else {
console.log(`${caseName} getIfaceRxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}
});
});
/**
* @tc.number Telephony_NetworkManager_getIfaceRxBytes_Async_0400
* @tc.name Test getIfaceRxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getIfaceRxBytes_Async_0400', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getIfaceRxBytes_Async_0400';
let ifaceName = null;
try {
statistics.getIfaceRxBytes(ifaceName, (err, data) => {
if (err) {
console.log(`${caseName} getIfaceRxBytes fail ${JSON.stringify(err)}`);
expect(err != undefined).assertTrue();
done();
} else {
console.log(`${caseName} getIfaceRxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}
});
} catch (err) {
console.log(`${caseName} getIfaceRxBytes into catch ${JSON.stringify(err)}`);
expect(err.code == 401).assertTrue();
done();
}
});
/**
* @tc.number Telephony_NetworkManager_getIfaceRxBytes_Promise_0100
* @tc.name Test getIfaceRxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getIfaceRxBytes_Promise_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getIfaceRxBytes_Promise_0100';
let ifaceName = "eth0";
statistics.getIfaceRxBytes(ifaceName).then((data) => {
console.log(`${caseName} getIfaceRxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}).catch((err) => {
console.log(`${caseName} getIfaceRxBytes fail ${JSON.stringify(err)} `);
done();
});
});
/**
* @tc.number Telephony_NetworkManager_getIfaceRxBytes_Promise_0200
* @tc.name Test getIfaceRxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getIfaceRxBytes_Promise_0200', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getIfaceRxBytes_Promise_0200';
let ifaceName = "wlan0";
statistics.getIfaceRxBytes(ifaceName).then((data) => {
console.log(`${caseName} getIfaceRxBytes success ${JSON.stringify(data)}`);
expect(data >= DATA_0).assertTrue();
done();
}).catch((err) => {
console.log(`${caseName} getIfaceRxBytes fail ${JSON.stringify(err)} `);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_NetworkManager_getIfaceRxBytes_Promise_0300
* @tc.name Test getIfaceRxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getIfaceRxBytes_Promise_0300', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getIfaceRxBytes_Promise_0300';
let ifaceName = "wlan1";
statistics.getIfaceRxBytes(ifaceName).then((data) => {
console.log(`${caseName} getIfaceRxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}).catch((err) => {
console.log(`${caseName} getIfaceRxBytes fail ${JSON.stringify(err)} `);
done();
});
});
/**
* @tc.number Telephony_NetworkManager_getIfaceRxBytes_Promise_0400
* @tc.name Test getIfaceRxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getIfaceRxBytes_Promise_0400', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getIfaceRxBytes_Promise_0400';
let ifaceName = null;
try {
statistics.getIfaceRxBytes(ifaceName).then((data) => {
console.log(`${caseName} getIfaceRxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}).catch((err) => {
console.log(`${caseName} getIfaceRxBytes fail ${JSON.stringify(err)}`);
expect(err != undefined).assertTrue();
done();
});
} catch (err) {
console.log(`${caseName} getIfaceRxBytes into catch ${JSON.stringify(err)}`);
expect(err.code == 401).assertTrue();
done();
}
});
/**
* @tc.number Telephony_NetworkManager_getIfaceTxBytes_Async_0100
* @tc.name Test getIfaceTxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getIfaceTxBytes_Async_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getIfaceTxBytes_Async_0100';
let ifaceName = "eth0";
statistics.getIfaceTxBytes(ifaceName, (err, data) => {
if (err) {
console.log(`${caseName} getIfaceTxBytes fail ${JSON.stringify(err)} `);
done();
} else {
console.log(`${caseName} getIfaceTxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}
});
});
/**
* @tc.number Telephony_NetworkManager_getIfaceTxBytes_Async_0200
* @tc.name Test getIfaceTxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getIfaceTxBytes_Async_0200', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getIfaceTxBytes_Async_0200';
let ifaceName = "wlan0";
statistics.getIfaceTxBytes(ifaceName, (err, data) => {
if (err) {
console.log(`${caseName} getIfaceTxBytes fail ${JSON.stringify(err)} `);
expect().assertFail();
done();
} else {
console.log(`${caseName} getIfaceTxBytes success ${JSON.stringify(data)}`);
expect(data >= DATA_0).assertTrue();
done();
}
});
});
/**
* @tc.number Telephony_NetworkManager_getIfaceTxBytes_Async_0300
* @tc.name Test getIfaceTxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getIfaceTxBytes_Async_0300', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getIfaceTxBytes_Async_0300';
let ifaceName = "wlan1";
statistics.getIfaceTxBytes(ifaceName, (err, data) => {
if (err) {
console.log(`${caseName} getIfaceTxBytes fail ${JSON.stringify(err)} `);
done();
} else {
console.log(`${caseName} getIfaceTxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}
});
});
/**
* @tc.number Telephony_NetworkManager_getIfaceTxBytes_Async_0400
* @tc.name Test getIfaceTxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getIfaceTxBytes_Async_0400', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getIfaceTxBytes_Async_0400';
let ifaceName = null;
try {
statistics.getIfaceTxBytes(ifaceName, (err, data) => {
if (err) {
console.log(`${caseName} getIfaceTxBytes fail ${JSON.stringify(err)}`);
expect(err != undefined).assertTrue();
done();
} else {
console.log(`${caseName} getIfaceTxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}
});
} catch (err) {
console.log(`${caseName} getIfaceTxBytes into catch ${JSON.stringify(err)}`);
expect(err.code == 401).assertTrue();
done();
}
});
/**
* @tc.number Telephony_NetworkManager_getIfaceTxBytes_Promise_0100
* @tc.name Test getIfaceTxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getIfaceTxBytes_Promise_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getIfaceTxBytes_Promise_0100';
let ifaceName = "eth0";
statistics.getIfaceTxBytes(ifaceName).then((data) => {
console.log(`${caseName} getIfaceTxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}).catch((err) => {
console.log(`${caseName} getIfaceTxBytes fail ${JSON.stringify(err)} `);
done();
});
});
/**
* @tc.number Telephony_NetworkManager_getIfaceTxBytes_Promise_0200
* @tc.name Test getIfaceTxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getIfaceTxBytes_Promise_0200', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getIfaceTxBytes_Promise_0200';
let ifaceName = "wlan0";
statistics.getIfaceTxBytes(ifaceName).then((data) => {
console.log(`${caseName} getIfaceTxBytes success ${JSON.stringify(data)}`);
expect(data >= DATA_0).assertTrue();
done();
}).catch((err) => {
console.log(`${caseName} getIfaceTxBytes fail ${JSON.stringify(err)} `);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_NetworkManager_getIfaceTxBytes_Promise_0300
* @tc.name Test getIfaceTxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getIfaceTxBytes_Promise_0300', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getIfaceTxBytes_Promise_0300';
let ifaceName = "wlan1";
statistics.getIfaceTxBytes(ifaceName).then((data) => {
console.log(`${caseName} getIfaceTxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}).catch((err) => {
console.log(`${caseName} getIfaceTxBytes fail ${JSON.stringify(err)} `);
done();
});
});
/**
* @tc.number Telephony_NetworkManager_getIfaceTxBytes_Promise_0400
* @tc.name Test getIfaceTxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getIfaceTxBytes_Promise_0400', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getIfaceTxBytes_Promise_0400';
let ifaceName = null;
try {
statistics.getIfaceTxBytes(ifaceName).then((data) => {
console.log(`${caseName} getIfaceTxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}).catch((err) => {
console.log(`${caseName} getIfaceTxBytes fail ${JSON.stringify(err)}`);
expect(err != undefined).assertTrue();
done();
});
} catch (err) {
console.log(`${caseName} getIfaceTxBytes into catch ${JSON.stringify(err)}`);
expect(err.code == 401).assertTrue();
done();
}
});
/**
* @tc.number Telephony_NetworkManager_getAllTxBytes_Async_0100
* @tc.name Test getAllTxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getAllTxBytes_Async_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getAllTxBytes_Async_0100';
statistics.getAllTxBytes((err, data) => {
if (err) {
console.log(`${caseName} getAllTxBytes fail ${JSON.stringify(err)} `);
expect().assertFail();
done();
} else {
console.log(`${caseName} getAllTxBytes success ${JSON.stringify(data)}`);
expect(data >= DATA_0).assertTrue();
done();
}
});
});
/**
* @tc.number Telephony_NetworkManager_getAllTxBytes_Promise_0100
* @tc.name Test getAllTxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getAllTxBytes_Promise_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getAllTxBytes_Promise_0100';
statistics.getAllTxBytes().then((data) => {
console.log(`${caseName} getAllTxBytes success ${JSON.stringify(data)}`);
expect(data >= DATA_0).assertTrue();
done();
}).catch((err) => {
console.log(`${caseName} getAllTxBytes fail ${JSON.stringify(err)} `);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_NetworkManager_getAllRxBytes_Async_0100
* @tc.name Test getAllRxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getAllRxBytes_Async_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getAllRxBytes_Async_0100';
statistics.getAllRxBytes((err, data) => {
if (err) {
console.log(`${caseName} getAllRxBytes fail ${JSON.stringify(err)} `);
expect().assertFail();
done();
} else {
console.log(`${caseName} getAllRxBytes success ${JSON.stringify(data)}`);
expect(data >= DATA_0).assertTrue();
done();
}
});
});
/**
* @tc.number Telephony_NetworkManager_getAllRxBytes_Promise_0100
* @tc.name Test getAllRxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getAllRxBytes_Promise_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getAllRxBytes_Promise_0100';
statistics.getAllRxBytes().then((data) => {
console.log(`${caseName} getAllRxBytes success ${JSON.stringify(data)}`);
expect(data >= DATA_0).assertTrue();
done();
}).catch((err) => {
console.log(`${caseName} getAllRxBytes fail ${JSON.stringify(err)} `);
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_NetworkManager_getUidRxBytes_Async_0100
* @tc.name Test getUidRxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getUidRxBytes_Async_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getUidRxBytes_Async_0100';
let uid = 20010084;
statistics.getUidRxBytes(uid, (err, data) => {
if (err) {
console.log(`${caseName} getUidRxBytes fail ${JSON.stringify(err)} `);
expect(err.code == 2103005).assertTrue();
done();
} else {
console.log(`${caseName} getUidRxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}
});
});
/**
* @tc.number Telephony_NetworkManager_getUidRxBytes_Async_0200
* @tc.name Test getUidRxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getUidRxBytes_Async_0200', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getUidRxBytes_Async_0200';
let uid = 20010084;
statistics.getUidRxBytes(uid, (err, data) => {
if (err) {
console.log(`${caseName} getUidRxBytes fail ${JSON.stringify(err)} `);
expect(err.code == 2103005).assertTrue();
done();
} else {
console.log(`${caseName} getUidRxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}
});
});
/**
* @tc.number Telephony_NetworkManager_getUidRxBytes_Promise_0100
* @tc.name Test getUidRxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getUidRxBytes_Promise_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getUidRxBytes_Promise_0100';
let uid = 20010084;
statistics.getUidRxBytes(uid).then((data) => {
console.log(`${caseName} getUidRxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}).catch((err) => {
console.log(`${caseName} getUidRxBytes fail ${JSON.stringify(err)} `);
expect(err.code == 2103005).assertTrue();
done();
});
});
/**
* @tc.number Telephony_NetworkManager_getUidRxBytes_Promise_0200
* @tc.name Test getUidRxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getUidRxBytes_Promise_0200', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getUidRxBytes_Promise_0200';
let uid = 20010084;
statistics.getUidRxBytes(uid).then((data) => {
console.log(`${caseName} getUidRxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}).catch((err) => {
console.log(`${caseName} getUidRxBytes fail ${JSON.stringify(err)} `);
expect(err.code == 2103005).assertTrue();
done();
});
});
/**
* @tc.number Telephony_NetworkManager_getUidTxBytes_Async_0100
* @tc.name Test getUidTxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getUidTxBytes_Async_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getUidTxBytes_Async_0100';
let uid = 20010084;
statistics.getUidTxBytes(uid, (err, data) => {
if (err) {
console.log(`${caseName} getUidTxBytes fail ${JSON.stringify(err)} `);
expect(err.code == 2103005).assertTrue();
done();
} else {
console.log(`${caseName} getUidTxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}
});
});
/**
* @tc.number Telephony_NetworkManager_getUidTxBytes_Async_0200
* @tc.name Test getUidTxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getUidTxBytes_Async_0200', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getUidTxBytes_Async_0200';
let uid = 20010084;
statistics.getUidTxBytes(uid, (err, data) => {
if (err) {
console.log(`${caseName} getUidTxBytes fail ${JSON.stringify(err)} `);
expect(err.code == 2103005).assertTrue();
done();
} else {
console.log(`${caseName} getUidTxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}
});
});
/**
* @tc.number Telephony_NetworkManager_getUidTxBytes_Promise_0100
* @tc.name Test getUidTxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getUidTxBytes_Promise_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getUidTxBytes_Promise_0100';
let uid = 20010084;
statistics.getUidTxBytes(uid).then((data) => {
console.log(`${caseName} getUidTxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}).catch((err) => {
console.log(`${caseName} getUidTxBytes fail ${JSON.stringify(err)} `);
expect(err.code == 2103005).assertTrue();
done();
});
});
/**
* @tc.number Telephony_NetworkManager_getUidTxBytes_Promise_0200
* @tc.name Test getUidTxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getUidTxBytes_Promise_0200', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getUidTxBytes_Promise_0200';
let uid = 20010084;
statistics.getUidTxBytes(uid).then((data) => {
console.log(`${caseName} getUidTxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}).catch((err) => {
console.log(`${caseName} getUidTxBytes fail ${JSON.stringify(err)} `);
expect(err.code == 2103005).assertTrue();
done();
});
});
/**
* @tc.number Telephony_NetworkManager_getCellularRxBytes_Async_0100
* @tc.name Test getCellularRxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getCellularRxBytes_Async_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getCellularRxBytes_Async_0100';
sim.hasSimCard(0, (err, data) => {
if (data === false) {
console.info(`${caseName} hasSimCard fail ${JSON.stringify(err)} `);
done();
return;
} else {
radio.isRadioOn(0).then((data) => {
console.info(`${caseName} isRadioOn ${JSON.stringify(data)} `);
expect(data == true).assertTrue();
statistics.getCellularRxBytes((err, data) => {
if (err) {
console.log(`${caseName} getCellularRxBytes fail ${JSON.stringify(err)} `);
expect(err.code).assertEqual(2103012);
done();
} else {
console.log(`${caseName} getCellularRxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}
});
}).catch((err) => {
console.error('When the device has no modem, the interface reports an error' + JSON.stringify(err));
expect(err.code).assertEqual(8300003);
done();
return;
});
}
});
});
/**
* @tc.number Telephony_NetworkManager_getCellularRxBytes_Promise_0100
* @tc.name Test getCellularRxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getCellularRxBytes_Promise_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getCellularRxBytes_Promise_0100';
sim.hasSimCard(0, (err, data) => {
if (data === false) {
console.info(`${caseName} hasSimCard fail ${JSON.stringify(err)} `);
done();
return;
} else {
radio.isRadioOn(0).then((data) => {
console.info(`${caseName} isRadioOn ${JSON.stringify(data)} `);
expect(data == true).assertTrue();
statistics.getCellularRxBytes().then((data) => {
console.log(`${caseName} getCellularRxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}).catch((err) => {
console.log(`${caseName} getCellularRxBytes fail ${JSON.stringify(err)} `);
expect(err.code == 2103012).assertTrue();
done();
});
}).catch((err) => {
console.error('When the device has no modem, the interface reports an error' + JSON.stringify(err));
expect(err.code).assertEqual(8300003);
done();
return;
});
}
});
});
/**
* @tc.number Telephony_NetworkManager_getCellularTxBytes_Async_0100
* @tc.name Test getCellularTxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getCellularTxBytes_Async_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getCellularTxBytes_Async_0100';
sim.hasSimCard(0, (err, data) => {
if (data === false) {
console.info(`${caseName} hasSimCard fail ${JSON.stringify(err)} `);
done();
return;
} else {
radio.isRadioOn(0).then((data) => {
console.info(`${caseName} isRadioOn ${JSON.stringify(data)} `);
expect(data == true).assertTrue();
statistics.getCellularTxBytes((err, data) => {
if (err) {
console.log(`${caseName} getCellularTxBytes fail ${JSON.stringify(err)} `);
expect(err.code == 2103012).assertTrue();
done();
} else {
console.log(`${caseName} getCellularTxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}
});
}).catch((err) => {
console.error('When the device has no modem, the interface reports an error' + JSON.stringify(err));
expect(err.code).assertEqual(8300003);
done();
return;
});
}
});
});
/**
* @tc.number Telephony_NetworkManager_getCellularTxBytes_Promise_0100
* @tc.name Test getCellularTxBytes() interface
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getCellularTxBytes_Promise_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getCellularTxBytes_Promise_0100';
sim.hasSimCard(0, (err, data) => {
if (data === false) {
console.info(`${caseName} hasSimCard fail ${JSON.stringify(err)} `);
done();
return;
} else {
radio.isRadioOn(0).then((data) => {
console.info(`${caseName} isRadioOn ${JSON.stringify(data)} `);
expect(data == true).assertTrue();
statistics.getCellularTxBytes().then((data) => {
console.log(`${caseName} getCellularTxBytes success ${JSON.stringify(data)}`);
expect().assertFail();
done();
}).catch((err) => {
console.log(`${caseName} getCellularTxBytes fail ${JSON.stringify(err)} `);
expect(err.code).assertEqual(2103012);
done();
});
}).catch((err) => {
console.error('When the device has no modem, the interface reports an error' + JSON.stringify(err));
expect(err.code).assertEqual(8300003);
done();
return;
});
}
});
});
});
};
telephony/telephonyjstest/network_search/network_search_errors/src/main/js/test/NetworkSearchErrors.test.js
浏览文件 @
22dbef13
...
...
@@ -235,11 +235,7 @@ describe('ActsNetworkSearchTest', function () {
}
done
();
});
/**
* @tc.number Telephony_NetworkSearch_getNetworkState_Promise_0700
* @tc.name SlotId parameter input is -1, test getNetworkState() query function go to the error
...
...
@@ -441,26 +437,6 @@ describe('ActsNetworkSearchTest', function () {
}
});
/**
* @tc.number Telephony_StateRegistry_on_0200
* @tc.name Add a networkStatus change listen and test observer.on({slotId:0}) to view the callback results
* @tc.desc Function test
*/
it
(
'
Telephony_StateRegistry_on_0200
'
,
0
,
async
function
(
done
)
{
try
{
observer
.
on
(
'
networkStateChange
'
,
{
slotId
:
0
},
NetworkState
=>
{
console
.
log
(
"
on networkStateChange, NetworkState:
"
+
JSON
.
stringify
(
NetworkState
));
expect
(
typeof
NetworkState
===
undefined
).
assertFalse
();
});
done
();
}
catch
(
error
)
{
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number Telephony_StateRegistry_off_0200
* @tc.name Add a networkStatus change listen and test observer.off() to view the callback results
...
...
@@ -483,26 +459,6 @@ describe('ActsNetworkSearchTest', function () {
}
});
/**
* @tc.number Telephony_StateRegistry_on_0300
* @tc.name Add a networkStatus change listen and test observer.on({slotId:0}) to view the callback results
* @tc.desc Function test
*/
it
(
'
Telephony_StateRegistry_on_0300
'
,
0
,
async
function
(
done
)
{
try
{
observer
.
on
(
'
signalInfoChange
'
,
{
slotId
:
0
},
SignalInformation
=>
{
console
.
log
(
"
on signalInfoChange, SignalInformation:
"
+
JSON
.
stringify
(
SignalInformation
));
expect
(
typeof
SignalInformation
===
undefined
).
assertFalse
();
});
done
();
}
catch
(
error
)
{
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number Telephony_StateRegistry_off_0300
* @tc.name Add a networkStatus change listen and test observer.off() to view the callback results
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录