未验证 提交 09b7d992 编写于 作者: O openharmony_ci 提交者: Gitee

!2760 【communication】修改XTS 代码检视问题2

Merge pull request !2760 from 权力/cherry-pick-1647926282
......@@ -29,7 +29,7 @@ async function tryToEnableWifi(){
console.info("wifi_test/wifi status:" + wifi.isWifiActive());
}
var GroupOwnerBand = {
let GroupOwnerBand = {
GO_BAND_AUTO : 0,
GO_BAND_2GHZ : 1,
GO_BAND_5GHZ : 2,
......@@ -50,7 +50,7 @@ describe('ACTS_WifiTest', function () {
it('SUB_Communication_WiFi_P2P_Setting_0001', 0, async function(done) {
await tryToEnableWifi();
console.info("[wifi_test] test setDeviceName start.");
var devName = wifi.setDeviceName("P2PTest");
let devName = wifi.setDeviceName("P2PTest");
console.info("[wifi_test] test start setDeviceName->" + devName);
expect(devName).assertTrue();
done();
......@@ -63,7 +63,7 @@ describe('ACTS_WifiTest', function () {
*/
it('SUB_Communication_WiFi_P2P_Config_0001', 0, async function(done) {
await tryToEnableWifi();
var WifiP2PConfig = {
let WifiP2PConfig = {
deviceAddress : "00:00:00:00:00:00",
netId : -1,
passphrase : "12345678",
......@@ -73,12 +73,12 @@ describe('ACTS_WifiTest', function () {
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
expect(wifi.isWifiActive()).assertTrue();
var addConfig = wifi.createGroup(WifiP2PConfig);
let addConfig = wifi.createGroup(WifiP2PConfig);
await sleep(2000);
expect(addConfig).assertTrue();
await wifi.getCurrentGroup()
.then((data) => {
var resultLength = Object.keys(data).length;
let resultLength = Object.keys(data).length;
console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data));
expect(true).assertEqual(resultLength!=0);
}).catch((error) => {
......@@ -96,7 +96,7 @@ describe('ACTS_WifiTest', function () {
*/
it('SUB_Communication_WiFi_P2P_Config_0002', 0, async function(done) {
await tryToEnableWifi();
var WifiP2PConfig = {
let WifiP2PConfig = {
deviceAddress : "00:00:00:00:00:00",
netId : -1,
passphrase : "12345678",
......@@ -106,7 +106,7 @@ describe('ACTS_WifiTest', function () {
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
expect(wifi.isWifiActive()).assertTrue();
var addConfig = wifi.createGroup(WifiP2PConfig);
let addConfig = wifi.createGroup(WifiP2PConfig);
await sleep(2000);
expect(addConfig).assertTrue();
......@@ -127,7 +127,7 @@ describe('ACTS_WifiTest', function () {
+ "groupName: " + result.groupName +
"clientDevices: " + result.clientDevices +"networkId: " + result.networkId
+ "frequency: " + result.frequency + "goIpAddress: " + result.goIpAddress);
var removeConfig = wifi.removeGroup();
let removeConfig = wifi.removeGroup();
expect(removeConfig).assertTrue();
done();
});
......@@ -140,7 +140,7 @@ describe('ACTS_WifiTest', function () {
*/
it('SUB_Communication_WiFi_P2P_Config_0003', 0, async function(done) {
await tryToEnableWifi();
var WifiP2PConfig2 = {
let WifiP2PConfig2 = {
deviceAddress : "00:00:00:00:00:00",
netId : -1,
passphrase : "12345678",
......@@ -150,19 +150,19 @@ describe('ACTS_WifiTest', function () {
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
expect(wifi.isWifiActive()).assertTrue();
var addConfig = wifi.createGroup(WifiP2PConfig2);
let addConfig = wifi.createGroup(WifiP2PConfig2);
await sleep(2000);
expect(addConfig).assertTrue();
await wifi.getCurrentGroup()
.then((data) => {
var resultLength = Object.keys(data).length;
let resultLength = Object.keys(data).length;
console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data));
expect(true).assertEqual(resultLength!=0);
}).catch((error) => {
console.info("[wifi_test]getCurrentGroup promise then error." + JSON.stringify(error));
expect(error).assertFail();
});
var removeConfig = wifi.removeGroup();
let removeConfig = wifi.removeGroup();
expect(removeConfig).assertTrue();
done();
})
......@@ -174,7 +174,7 @@ describe('ACTS_WifiTest', function () {
*/
it('SUB_Communication_WiFi_P2P_Config_0004', 0, async function(done) {
await tryToEnableWifi();
var WifiP2PConfig = {
let WifiP2PConfig = {
deviceAddress : "00:00:00:00:00:00",
netId : -2,
passphrase : "12345678",
......@@ -184,19 +184,19 @@ describe('ACTS_WifiTest', function () {
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
expect(wifi.isWifiActive()).assertTrue();
var addConfig = wifi.createGroup(WifiP2PConfig);
let addConfig = wifi.createGroup(WifiP2PConfig);
await sleep(2000);
expect(addConfig).assertTrue();
await wifi.getCurrentGroup()
.then((data) => {
var resultLength = Object.keys(data).length;
let resultLength = Object.keys(data).length;
console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data));
expect(true).assertEqual(resultLength!=0);
var removePConfig = wifi.deletePersistentGroup(data.networkId);
let removePConfig = wifi.deletePersistentGroup(data.networkId);
expect(removePConfig).assertTrue();
var removeConfig = wifi.removeGroup();
let removeConfig = wifi.removeGroup();
expect(removeConfig).assertTrue();
});
done();
......@@ -209,7 +209,7 @@ describe('ACTS_WifiTest', function () {
*/
it('SUB_Communication_WiFi_P2P_Config_0005', 0, async function(done) {
await tryToEnableWifi();
var WifiP2PConfig3 = {
let WifiP2PConfig3 = {
deviceAddress : "00:00:00:00:00:00",
netId : -2,
passphrase : "12345678",
......@@ -219,14 +219,14 @@ describe('ACTS_WifiTest', function () {
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
expect(wifi.isWifiActive()).assertTrue();
var scanConfig = wifi.startDiscoverDevices();
let scanConfig = wifi.startDiscoverDevices();
await sleep(2000);
expect(scanConfig).assertTrue();
var connConfig = wifi.p2pConnect(WifiP2PConfig3);
let connConfig = wifi.p2pConnect(WifiP2PConfig3);
console.info("[wifi_test] test p2pConnect result." + connConfig);
expect(connConfig).assertTrue();
var stopScan = wifi.stopDiscoverDevices();
let stopScan = wifi.stopDiscoverDevices();
console.info("[wifi_test] test stopDiscoverDevices result." + stopScan);
done()
})
......@@ -238,13 +238,13 @@ describe('ACTS_WifiTest', function () {
*/
it('SUB_Communication_WiFi_P2P_Config_0006', 0, async function(done) {
await tryToEnableWifi();
var P2pConnectState = {
let P2pConnectState = {
DISCONNECTED :0,
CONNECTED : 1,
};
await wifi.getP2pLinkedInfo()
.then((data) => {
var resultLength = Object.keys(data).length;
let resultLength = Object.keys(data).length;
console.info("[wifi_test] getP2pLinkedInfo [promise] result -> " + JSON.stringify(data));
expect(true).assertEqual(resultLength!=0);
}).catch((error) => {
......@@ -262,7 +262,7 @@ describe('ACTS_WifiTest', function () {
*/
it('SUB_Communication_WiFi_P2P_Config_0007', 0, async function(done) {
await tryToEnableWifi();
var P2pConnectState = {
let P2pConnectState = {
DISCONNECTED :0,
CONNECTED : 1,
};
......@@ -288,11 +288,11 @@ describe('ACTS_WifiTest', function () {
*/
it('SUB_Communication_WiFi_P2P_Config_0008', 0, async function(done) {
await tryToEnableWifi();
var disConn = wifi.p2pCancelConnect();
let disConn = wifi.p2pCancelConnect();
await sleep(2000);
console.info("[wifi_test] test p2pCancelConnect result." + disConn);
expect(disConn).assertTrue();
var removeConfig = wifi.removeGroup();
let removeConfig = wifi.removeGroup();
console.info("[wifi_test] test start removeGroup" + removeConfig);
expect(removeConfig).assertTrue();
done();
......@@ -305,7 +305,7 @@ describe('ACTS_WifiTest', function () {
*/
it('SUB_Communication_WiFi_P2P_Config_0009', 0, async function(done){
await tryToEnableWifi();
var P2pDeviceStatus = {
let P2pDeviceStatus = {
CONNECTED : 0,
INVITED : 1,
FAILED : 2,
......@@ -315,12 +315,12 @@ describe('ACTS_WifiTest', function () {
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
expect(wifi.isWifiActive()).assertTrue();
var scanConfig = wifi.startDiscoverDevices();
let scanConfig = wifi.startDiscoverDevices();
await sleep(2000);
expect(scanConfig).assertTrue();
await wifi.getP2pPeerDevices()
.then((data) => {
var resultLength = Object.keys(data).length;
let resultLength = Object.keys(data).length;
console.info("[wifi_test] getP2pPeerDevices [promise] result -> " + JSON.stringify(data));
expect(true).assertEqual(resultLength >= 0);
}).catch((error) => {
......@@ -338,7 +338,7 @@ describe('ACTS_WifiTest', function () {
*/
it('SUB_Communication_WiFi_P2P_Config_0010', 0, async function(done){
await tryToEnableWifi();
var P2pDeviceStatus = {
let P2pDeviceStatus = {
CONNECTED : 0,
INVITED : 1,
FAILED : 2,
......@@ -348,7 +348,7 @@ describe('ACTS_WifiTest', function () {
console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive());
expect(wifi.isWifiActive()).assertTrue();
var scanConfig = wifi.startDiscoverDevices();
let scanConfig = wifi.startDiscoverDevices();
await sleep(2000);
expect(scanConfig).assertTrue();
......@@ -358,8 +358,8 @@ describe('ACTS_WifiTest', function () {
return;
}
console.info("[wifi_test] getP2pPeerDevices [callback] -> " + JSON.stringify(result));
var len = Object.keys(result).length;
for (var j = 0; j < len; ++j) {
let len = Object.keys(result).length;
for (let j = 0; j < len; ++j) {
console.info("deviceName: " + result[j].deviceName +
"deviceAddress: " + result[j].deviceAddress +
"primaryDeviceType: " + result[j].primaryDeviceType +
......@@ -381,7 +381,7 @@ describe('ACTS_WifiTest', function () {
console.info("deviceStatus: " + result[j].deviceStatus);
}
}
var stopScan = wifi.stopDiscoverDevices();
let stopScan = wifi.stopDiscoverDevices();
expect(stopScan).assertTrue();
done();
});
......@@ -460,7 +460,7 @@ describe('ACTS_WifiTest', function () {
*/
it('SUB_Communication_WiFi_P2P_p2pPeerDeviceChange_0004', 0, async function (done) {
await tryToEnableWifi();
var recvP2pPeerDeviceChangeFunc = result => {
let recvP2pPeerDeviceChangeFunc = result => {
console.info("wifi_test / p2p peer device change receive event: " + JSON.stringify(result));
wifi.getP2pDevices((err, data) => {
if (err) {
......@@ -468,12 +468,12 @@ describe('ACTS_WifiTest', function () {
return;
}
console.info("wifi_test / getP2pDevices [callback] -> " + JSON.stringify(data));
var len = Object.keys(data).length;
let len = Object.keys(data).length;
console.log("getP2pDevices number: " + len);
for (var i = 0; i < len; ++i) {
for (let i = 0; i < len; ++i) {
if (data[i].deviceName === "GRE") {
console.info("wifi_test / p2pConnect: -> " + data[i].deviceAddress);
var config = {
let config = {
"deviceAddress":data[i].deviceAddress,
"netId":-1,
"passphrase":"",
......@@ -506,16 +506,16 @@ describe('ACTS_WifiTest', function () {
*/
it('SUB_Communication_WiFi_P2P_p2pPersistentGroupChange_0005', 0, async function (done) {
await tryToEnableWifi();
var recvP2pPersistentGroupChangeFunc = result => {
let recvP2pPersistentGroupChangeFunc = result => {
console.info("wifi_test / p2p persistent group change receive event" + JSON.stringify(result));
var config = {
let config = {
"deviceAddress" : "02:11:65:f2:0d:6e",
"netId":-2,
"passphrase":"",
"groupName":"",
"goBand":0,
};
var addConfig = wifi.createGroup(config);
let addConfig = wifi.createGroup(config);
expect(addConfig).assertTrue();
wifi.getCurrentGroup((err, data) => {
if (err) {
......@@ -563,3 +563,4 @@ describe('ACTS_WifiTest', function () {
console.log("*************[wifi_test] start wifi js unit test end*************");
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册