Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
6e384123
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看板
未验证
提交
6e384123
编写于
8月 02, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 02, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9659 【XTS】【communication】wifi,BT流水线失败项修改
Merge pull request !9659 from 权力/myfeature
上级
e185b7df
ebceba2f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
425 addition
and
312 deletion
+425
-312
communication/bluetooth_gatt/src/main/js/test/BtManagerGattManager.test.js
...etooth_gatt/src/main/js/test/BtManagerGattManager.test.js
+15
-11
communication/wifi_p2p/src/main/js/test/WifiManagerP2PEvent.test.js
...ion/wifi_p2p/src/main/js/test/WifiManagerP2PEvent.test.js
+1
-0
communication/wifi_p2p/src/main/js/test/WifiManagerP2PFunction.test.js
.../wifi_p2p/src/main/js/test/WifiManagerP2PFunction.test.js
+7
-1
communication/wifi_standard/src/main/js/test/WifiManagerCandidateNetWork.test.js
...dard/src/main/js/test/WifiManagerCandidateNetWork.test.js
+76
-37
communication/wifi_standard/src/main/js/test/WifiManagerStationFunctions.test.js
...dard/src/main/js/test/WifiManagerStationFunctions.test.js
+326
-263
未找到文件。
communication/bluetooth_gatt/src/main/js/test/BtManagerGattManager.test.js
浏览文件 @
6e384123
...
@@ -218,24 +218,20 @@ describe('btManagerGattManagerTest', function() {
...
@@ -218,24 +218,20 @@ describe('btManagerGattManagerTest', function() {
* @tc.type Function
* @tc.type Function
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_COMMUNICATION_BTMANAGER_GETDEVICENAME_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_COMMUNICATION_BTMANAGER_GETDEVICENAME_0100
'
,
0
,
async
function
(
done
)
{
await
sleep
(
5000
)
try
{
try
{
await
gattClient
.
getDeviceName
().
then
((
data
)
=>
{
await
gattClient
.
getDeviceName
().
then
((
data
)
=>
{
console
.
info
(
'
[bluetooth_js] device name:
'
+
JSON
.
stringify
(
data
))
console
.
info
(
'
[bluetooth_js] device name:
'
+
JSON
.
stringify
(
data
))
expect
(
true
).
assertEqual
(
data
!=
null
);
expect
(
true
).
assertEqual
(
data
!=
null
);
done
();
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
error
(
'
[bluetooth_js] bluetooth getDeviceName has error:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
[bluetooth_js] bluetooth getDeviceName has error:
'
+
JSON
.
stringify
(
err
));
expect
(
err
).
assertFalse
();
expect
(
err
.
code
).
assertEqual
(
2900099
);
done
();
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
`[bluetooth_js]GetDeviceName_0100 failed, code is
${
error
.
code
}
,
console
.
error
(
`[bluetooth_js]GetDeviceName_0100 failed, code is
${
error
.
code
}
,message is
${
error
.
message
}
`
);
message is
${
error
.
message
}
`
);
expect
(
error
.
code
).
assertEqual
(
'
2900099
'
);
expect
(
true
).
assertFalse
();
}
done
()
done
();
}
})
})
/**
/**
...
@@ -305,7 +301,7 @@ describe('btManagerGattManagerTest', function() {
...
@@ -305,7 +301,7 @@ describe('btManagerGattManagerTest', function() {
expect
(
true
).
assertEqual
(
data
.
length
>=
0
);
expect
(
true
).
assertEqual
(
data
.
length
>=
0
);
}
else
{
}
else
{
console
.
info
(
'
[bluetooth_js] get services code
'
+
JSON
.
stringify
(
code
));
console
.
info
(
'
[bluetooth_js] get services code
'
+
JSON
.
stringify
(
code
));
expect
(
true
).
assertEqual
(
code
.
code
==
-
1
);
expect
(
false
).
assertEqual
(
code
.
code
==
0
);
}
}
done
();
done
();
});
});
...
@@ -475,6 +471,14 @@ describe('btManagerGattManagerTest', function() {
...
@@ -475,6 +471,14 @@ describe('btManagerGattManagerTest', function() {
console
.
log
(
'
bluetooth characteristic characteristicUuid:
'
+
BLECharacteristic
.
characteristicUuid
);
console
.
log
(
'
bluetooth characteristic characteristicUuid:
'
+
BLECharacteristic
.
characteristicUuid
);
console
.
log
(
'
bluetooth characteristic characteristicValue:
'
+
BLECharacteristic
.
characteristicValue
);
console
.
log
(
'
bluetooth characteristic characteristicValue:
'
+
BLECharacteristic
.
characteristicValue
);
console
.
log
(
'
bluetooth characteristic descriptors:
'
+
BLECharacteristic
.
descriptors
);
console
.
log
(
'
bluetooth characteristic descriptors:
'
+
BLECharacteristic
.
descriptors
);
console
.
log
(
'
bluetooth characteristic properties:
'
+
BLECharacteristic
.
properties
);
console
.
log
(
'
bluetooth BLECharacteristic write:
'
+
BLECharacteristic
.
properties
.
write
);
console
.
log
(
'
bluetooth BLECharacteristic writeNoResponse:
'
+
BLECharacteristic
.
properties
.
writeNoResponse
);
console
.
log
(
'
bluetooth BLECharacteristic read:
'
+
BLECharacteristic
.
properties
.
read
);
console
.
log
(
'
bluetooth BLECharacteristic notify:
'
+
BLECharacteristic
.
properties
.
notify
);
console
.
log
(
'
bluetooth BLECharacteristic indicate:
'
+
BLECharacteristic
.
properties
.
indicate
);
let
value
=
new
Uint8Array
(
BLECharacteristic
.
characteristicValue
);
let
value
=
new
Uint8Array
(
BLECharacteristic
.
characteristicValue
);
console
.
log
(
'
bluetooth characteristic value:
'
console
.
log
(
'
bluetooth characteristic value:
'
+
value
[
0
]
+
'
,
'
+
value
[
1
]
+
'
,
'
+
value
[
2
]
+
'
,
'
+
value
[
3
]);
+
value
[
0
]
+
'
,
'
+
value
[
1
]
+
'
,
'
+
value
[
2
]
+
'
,
'
+
value
[
3
]);
...
...
communication/wifi_p2p/src/main/js/test/WifiManagerP2PEvent.test.js
浏览文件 @
6e384123
...
@@ -101,6 +101,7 @@ export default function actsWifiManagerEventTest() {
...
@@ -101,6 +101,7 @@ export default function actsWifiManagerEventTest() {
};
};
let
wifiP2PConfig
=
{
let
wifiP2PConfig
=
{
deviceAddress
:
"
22:9b:e6:48:1f:5c
"
,
deviceAddress
:
"
22:9b:e6:48:1f:5c
"
,
deviceAddressType
:
1
,
netId
:
-
1
,
netId
:
-
1
,
passphrase
:
"
12345678
"
,
passphrase
:
"
12345678
"
,
groupName
:
"
DIRECT-AAAZZZ456
"
,
groupName
:
"
DIRECT-AAAZZZ456
"
,
...
...
communication/wifi_p2p/src/main/js/test/WifiManagerP2PFunction.test.js
浏览文件 @
6e384123
...
@@ -604,8 +604,13 @@ export default function actsWifiManagerFunctionTest() {
...
@@ -604,8 +604,13 @@ export default function actsWifiManagerFunctionTest() {
* @tc.level Level 3
* @tc.level Level 3
*/
*/
it
(
'
SUB_Communication_WiFi_XTS_P2P_0009
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_Communication_WiFi_XTS_P2P_0009
'
,
0
,
async
function
(
done
)
{
let
DeviceAddressType
=
{
RANDOM_DEVICE_ADDRESS
:
0
,
REAL_DEVICE_ADDRESS
:
1
,
};
let
wifiP2PConfig
=
{
let
wifiP2PConfig
=
{
deviceAddress
:
"
11:22:33:44:55:66
"
,
deviceAddress
:
"
11:22:33:44:55:66
"
,
deviceAddressType
:
wifiMg
.
DeviceAddressType
.
REAL_DEVICE_ADDRESS
,
netId
:
-
1
,
netId
:
-
1
,
passphrase
:
"
12345678
"
,
passphrase
:
"
12345678
"
,
groupName
:
"
DIRECT-AAAZZZ456
"
,
groupName
:
"
DIRECT-AAAZZZ456
"
,
...
@@ -694,7 +699,8 @@ export default function actsWifiManagerFunctionTest() {
...
@@ -694,7 +699,8 @@ export default function actsWifiManagerFunctionTest() {
}
}
console
.
info
(
"
[wifi_test]getP2pLocalDevice callback result:
"
+
JSON
.
stringify
(
ret
));
console
.
info
(
"
[wifi_test]getP2pLocalDevice callback result:
"
+
JSON
.
stringify
(
ret
));
console
.
info
(
"
deviceName:
"
+
ret
.
deviceName
+
"
deviceAddress:
"
+
console
.
info
(
"
deviceName:
"
+
ret
.
deviceName
+
"
deviceAddress:
"
+
ret
.
deviceAddress
+
"
primaryDeviceType:
"
+
ret
.
primaryDeviceType
+
ret
.
deviceAddress
+
"
deviceAddressType:
"
+
ret
.
deviceAddressType
+
"
primaryDeviceType:
"
+
ret
.
primaryDeviceType
+
"
deviceStatus:
"
+
ret
.
deviceStatus
+
"
groupCapabilitys:
"
+
"
deviceStatus:
"
+
ret
.
deviceStatus
+
"
groupCapabilitys:
"
+
ret
.
groupCapabilitys
);
ret
.
groupCapabilitys
);
resolve
();
resolve
();
...
...
communication/wifi_standard/src/main/js/test/WifiManagerCandidateNetWork.test.js
浏览文件 @
6e384123
...
@@ -68,12 +68,12 @@ export default function actsWifiManagerCandidateNetWorkTest() {
...
@@ -68,12 +68,12 @@ export default function actsWifiManagerCandidateNetWorkTest() {
})
})
/**
/**
* @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0001
* @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0001
* @tc.name testaddCandidateConfig
* @tc.name testaddCandidateConfig
* @tc.desc Test add OPEN and WEP CandidateConfig Promise API functionality.
* @tc.desc Test add OPEN and WEP CandidateConfig Promise API functionality.
* @tc.type Function
* @tc.type Function
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_Communication_WiFi_XTS_CandidateNetWork_0001
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_Communication_WiFi_XTS_CandidateNetWork_0001
'
,
0
,
async
function
(
done
)
{
let
wifiDeviceConfig
=
{
let
wifiDeviceConfig
=
{
"
ssid
"
:
"
TEST_OPEN
"
,
"
ssid
"
:
"
TEST_OPEN
"
,
...
@@ -131,16 +131,55 @@ export default function actsWifiManagerCandidateNetWorkTest() {
...
@@ -131,16 +131,55 @@ export default function actsWifiManagerCandidateNetWorkTest() {
})
})
/**
/**
* @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0002
* @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0002
* @tc.name testaddCandidateConfig
* @tc.name testaddCandidateConfig
* @tc.desc Test add PSK CandidateConfig and removeCandidateConfig Promise API functionality.
* @tc.desc Test add PSK CandidateConfig and removeCandidateConfig Promise API functionality.
* @tc.type Function
* @tc.type Function
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_Communication_WiFi_XTS_CandidateNetWork_0002
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_Communication_WiFi_XTS_CandidateNetWork_0002
'
,
0
,
async
function
(
done
)
{
let
EapMethod
=
{
"
EAP_NONE
"
:
0
,
"
EAP_PEAP
"
:
1
,
"
EAP_TLS
"
:
2
,
"
EAP_TTLS
"
:
3
,
"
EAP_PWD
"
:
4
,
"
EAP_SIM
"
:
5
,
"
EAP_AKA
"
:
6
,
"
EAP_AKA_PRIME
"
:
7
,
"
EAP_UNAUTH_TLS
"
:
8
,
};
let
Phase2Method
=
{
"
PHASE2_NONE
"
:
0
,
"
PHASE2_PAP
"
:
1
,
"
PHASE2_MSCHAP
"
:
2
,
"
PHASE2_MSCHAPV2
"
:
3
,
"
PHASE2_GTC
"
:
4
,
"
PHASE2_SIM
"
:
5
,
"
PHASE2_AKA
"
:
6
,
"
PHASE2_AKA_PRIME
"
:
7
,
};
let
WifiEapConfig
=
{
"
eapMethod
"
:
wifiMg
.
EapMethod
.
EAP_NONE
,
"
phase2Method
"
:
wifiMg
.
Phase2Method
.
PHASE2_NONE
,
"
identity
"
:
"
aaa
"
,
"
anonymousIdentity
"
:
"
bbb
"
,
"
password
"
:
"
12345678
"
,
"
caCertAliases
"
:
"
ddd
"
,
"
caPath
"
:
"
eee
"
,
"
clientCertAliases
"
:
"
fff
"
,
"
certEntry
"
:
new
Uint8Array
(),
"
certPassword
"
:
"
12345678
"
,
"
altSubjectMatch
"
:
"
ggg
"
,
"
domainSuffixMatch
"
:
"
hhh
"
,
"
realm
"
:
"
iii
"
,
"
plmn
"
:
"
jjj
"
,
"
eapSubId
"
:
"
kkk
"
,
};
let
wifiDeviceConfig
=
{
let
wifiDeviceConfig
=
{
"
ssid
"
:
"
TEST_PSK
"
,
"
ssid
"
:
"
TEST_PSK
"
,
"
bssid
"
:
"
22:9b:e6:48:1f:5c
"
,
"
bssid
"
:
"
22:9b:e6:48:1f:5c
"
,
"
bssidType
"
:
1
,
"
preSharedKey
"
:
"
12345678
"
,
"
preSharedKey
"
:
"
12345678
"
,
"
isHiddenSsid
"
:
false
,
"
isHiddenSsid
"
:
false
,
"
securityType
"
:
wifiMg
.
WifiSecurityType
.
WIFI_SEC_TYPE_PSK
,
"
securityType
"
:
wifiMg
.
WifiSecurityType
.
WIFI_SEC_TYPE_PSK
,
...
@@ -151,6 +190,7 @@ export default function actsWifiManagerCandidateNetWorkTest() {
...
@@ -151,6 +190,7 @@ export default function actsWifiManagerCandidateNetWorkTest() {
"
randomMacType
"
:
0
,
"
randomMacType
"
:
0
,
"
randomMacAddr
"
:
"
11:22:33:44:55:66
"
,
"
randomMacAddr
"
:
"
11:22:33:44:55:66
"
,
"
staticIp
"
:
{
"
ipAddress
"
:
1284752956
,
"
gateway
"
:
1284752936
},
"
staticIp
"
:
{
"
ipAddress
"
:
1284752956
,
"
gateway
"
:
1284752936
},
"
eapConfig
"
:
wifiMg
.
WifiEapConfig
,
};
};
await
wifiMg
.
addCandidateConfig
(
wifiDeviceConfig
)
await
wifiMg
.
addCandidateConfig
(
wifiDeviceConfig
)
.
then
(
netWorkId
=>
{
.
then
(
netWorkId
=>
{
...
@@ -178,12 +218,12 @@ export default function actsWifiManagerCandidateNetWorkTest() {
...
@@ -178,12 +218,12 @@ export default function actsWifiManagerCandidateNetWorkTest() {
})
})
/**
/**
* @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0003
* @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0003
* @tc.name testaddCandidateConfig
* @tc.name testaddCandidateConfig
* @tc.desc Test add SAE CandidateConfig Promise API functionality.
* @tc.desc Test add SAE CandidateConfig Promise API functionality.
* @tc.type Function
* @tc.type Function
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_Communication_WiFi_XTS_CandidateNetWork_0003
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_Communication_WiFi_XTS_CandidateNetWork_0003
'
,
0
,
async
function
(
done
)
{
let
wifiDeviceConfig
=
{
let
wifiDeviceConfig
=
{
"
ssid
"
:
"
TEST_SAE
"
,
"
ssid
"
:
"
TEST_SAE
"
,
...
@@ -217,12 +257,12 @@ export default function actsWifiManagerCandidateNetWorkTest() {
...
@@ -217,12 +257,12 @@ export default function actsWifiManagerCandidateNetWorkTest() {
})
})
/**
/**
* @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0004
* @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0004
* @tc.name testaddCandidateConfig
* @tc.name testaddCandidateConfig
* @tc.desc Test add MAX CandidateConfig and removeall CandidateConfig.
* @tc.desc Test add MAX CandidateConfig and removeall CandidateConfig.
* @tc.type Function
* @tc.type Function
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_Communication_WiFi_XTS_CandidateNetWork_0004
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_Communication_WiFi_XTS_CandidateNetWork_0004
'
,
0
,
async
function
(
done
)
{
let
SSID
=
"
TYPE_PSK
"
let
SSID
=
"
TYPE_PSK
"
for
(
let
i
=
0
;
i
<
16
;
i
++
)
{
for
(
let
i
=
0
;
i
<
16
;
i
++
)
{
...
@@ -278,12 +318,12 @@ export default function actsWifiManagerCandidateNetWorkTest() {
...
@@ -278,12 +318,12 @@ export default function actsWifiManagerCandidateNetWorkTest() {
})
})
/**
/**
* @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0005
* @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0005
* @tc.name testaddCandidateConfig
* @tc.name testaddCandidateConfig
* @tc.desc Test add CandidateConfig and removeCandidateConfig callback API functionality.
* @tc.desc Test add CandidateConfig and removeCandidateConfig callback API functionality.
* @tc.type Function
* @tc.type Function
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_Communication_WiFi_XTS_CandidateNetWork_0005
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_Communication_WiFi_XTS_CandidateNetWork_0005
'
,
0
,
async
function
(
done
)
{
let
wifiDeviceConfig
=
{
let
wifiDeviceConfig
=
{
"
ssid
"
:
"
TEST_connect
"
,
"
ssid
"
:
"
TEST_connect
"
,
...
@@ -329,12 +369,12 @@ export default function actsWifiManagerCandidateNetWorkTest() {
...
@@ -329,12 +369,12 @@ export default function actsWifiManagerCandidateNetWorkTest() {
})
})
/**
/**
* @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0006
* @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0006
* @tc.name testaddCandidateConfig
* @tc.name testaddCandidateConfig
* @tc.desc Test connect To CandidateConfig API functionality.
* @tc.desc Test connect To CandidateConfig API functionality.
* @tc.type Function
* @tc.type Function
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_Communication_WiFi_XTS_CandidateNetWork_0006
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_Communication_WiFi_XTS_CandidateNetWork_0006
'
,
0
,
async
function
(
done
)
{
let
wifiDeviceConfig
=
{
let
wifiDeviceConfig
=
{
"
ssid
"
:
"
HONOR 3000
"
,
"
ssid
"
:
"
HONOR 3000
"
,
...
@@ -381,4 +421,3 @@ export default function actsWifiManagerCandidateNetWorkTest() {
...
@@ -381,4 +421,3 @@ export default function actsWifiManagerCandidateNetWorkTest() {
})
})
})
})
}
}
communication/wifi_standard/src/main/js/test/WifiManagerStationFunctions.test.js
浏览文件 @
6e384123
...
@@ -67,275 +67,278 @@ export default function actsWifiManagerFunctionsTest() {
...
@@ -67,275 +67,278 @@ export default function actsWifiManagerFunctionsTest() {
afterEach
(
function
()
{
afterEach
(
function
()
{
})
})
/**
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0021
* @tc.number SUB_Communication_WiFi_XTS_Sta_0021
* @tc.name testGetSignalLevel
* @tc.name testGetSignalLevel
* @tc.desc Test getSignalLevel API functionality..
* @tc.desc Test getSignalLevel API functionality..
* @tc.type Function
* @tc.type Function
* @tc.level Level 3
* @tc.level Level 3
*/
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0021
'
,
0
,
function
()
{
it
(
'
SUB_Communication_WiFi_XTS_Sta_0021
'
,
0
,
function
()
{
console
.
info
(
"
[wifi_test] check the 2.4G rssi assgined to level test.
"
);
console
.
info
(
"
[wifi_test] check the 2.4G rssi assgined to level test.
"
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
65
,
1
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
65
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
65
,
1
)).
assertEqual
(
4
);
expect
(
wifiMg
.
getSignalLevel
(
-
65
,
1
)).
assertEqual
(
4
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
66
,
1
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
66
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
66
,
1
)).
assertEqual
(
3
);
expect
(
wifiMg
.
getSignalLevel
(
-
66
,
1
)).
assertEqual
(
3
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
75
,
1
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
75
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
75
,
1
)).
assertEqual
(
3
);
expect
(
wifiMg
.
getSignalLevel
(
-
75
,
1
)).
assertEqual
(
3
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
76
,
1
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
76
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
76
,
1
)).
assertEqual
(
2
);
expect
(
wifiMg
.
getSignalLevel
(
-
76
,
1
)).
assertEqual
(
2
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
82
,
1
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
82
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
82
,
1
)).
assertEqual
(
2
);
expect
(
wifiMg
.
getSignalLevel
(
-
82
,
1
)).
assertEqual
(
2
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
83
,
1
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
83
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
83
,
1
)).
assertEqual
(
1
);
expect
(
wifiMg
.
getSignalLevel
(
-
83
,
1
)).
assertEqual
(
1
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
88
,
1
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
88
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
88
,
1
)).
assertEqual
(
1
);
expect
(
wifiMg
.
getSignalLevel
(
-
88
,
1
)).
assertEqual
(
1
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
89
,
1
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
89
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
89
,
1
)).
assertEqual
(
0
);
expect
(
wifiMg
.
getSignalLevel
(
-
89
,
1
)).
assertEqual
(
0
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
127
,
1
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
127
,
1
));
expect
(
wifiMg
.
getSignalLevel
(
-
127
,
1
)).
assertEqual
(
0
);
expect
(
wifiMg
.
getSignalLevel
(
-
127
,
1
)).
assertEqual
(
0
);
console
.
info
(
"
[wifi_test] check the 5G rssi assgined to level test.
"
);
console
.
info
(
"
[wifi_test] check the 5G rssi assgined to level test.
"
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
65
,
2
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
65
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
65
,
2
)).
assertEqual
(
4
);
expect
(
wifiMg
.
getSignalLevel
(
-
65
,
2
)).
assertEqual
(
4
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
66
,
2
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
66
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
66
,
2
)).
assertEqual
(
3
);
expect
(
wifiMg
.
getSignalLevel
(
-
66
,
2
)).
assertEqual
(
3
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
72
,
2
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
72
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
72
,
2
)).
assertEqual
(
3
);
expect
(
wifiMg
.
getSignalLevel
(
-
72
,
2
)).
assertEqual
(
3
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
73
,
2
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
73
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
73
,
2
)).
assertEqual
(
2
);
expect
(
wifiMg
.
getSignalLevel
(
-
73
,
2
)).
assertEqual
(
2
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
79
,
2
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
79
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
79
,
2
)).
assertEqual
(
2
);
expect
(
wifiMg
.
getSignalLevel
(
-
79
,
2
)).
assertEqual
(
2
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
80
,
2
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
80
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
80
,
2
)).
assertEqual
(
1
);
expect
(
wifiMg
.
getSignalLevel
(
-
80
,
2
)).
assertEqual
(
1
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
85
,
2
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
85
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
85
,
2
)).
assertEqual
(
1
);
expect
(
wifiMg
.
getSignalLevel
(
-
85
,
2
)).
assertEqual
(
1
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
86
,
2
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
86
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
86
,
2
)).
assertEqual
(
0
);
expect
(
wifiMg
.
getSignalLevel
(
-
86
,
2
)).
assertEqual
(
0
);
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
127
,
2
));
console
.
info
(
"
[wifi_test] getSignalLevel
"
+
wifiMg
.
getSignalLevel
(
-
127
,
2
));
expect
(
wifiMg
.
getSignalLevel
(
-
127
,
2
)).
assertEqual
(
0
);
expect
(
wifiMg
.
getSignalLevel
(
-
127
,
2
)).
assertEqual
(
0
);
})
})
/**
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0017
* @tc.number SUB_Communication_WiFi_XTS_Sta_0017
* @tc.name testgetCountryCode
* @tc.name testgetCountryCode
* @tc.desc Test getCountryCode API function.
* @tc.desc Test getCountryCode API function.
* @tc.type Function
* @tc.type Function
* @tc.level Level 3
* @tc.level Level 3
*/
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0017
'
,
0
,
function
()
{
it
(
'
SUB_Communication_WiFi_XTS_Sta_0017
'
,
0
,
function
()
{
expect
(
wifiMg
.
isWifiActive
()).
assertTrue
();
expect
(
wifiMg
.
isWifiActive
()).
assertTrue
();
let
getCountryCodeResult
=
wifiMg
.
getCountryCode
();
let
getCountryCodeResult
=
wifiMg
.
getCountryCode
();
console
.
info
(
"
[wifi_test]getCountryCode :
"
+
JSON
.
stringify
(
getCountryCodeResult
));
console
.
info
(
"
[wifi_test]getCountryCode :
"
+
JSON
.
stringify
(
getCountryCodeResult
));
let
countrylenth
=
getCountryCodeResult
.
length
;
let
countrylenth
=
getCountryCodeResult
.
length
;
console
.
info
(
"
[wifi_test]getCountryCode.length :
"
+
JSON
.
stringify
(
countrylenth
));
console
.
info
(
"
[wifi_test]getCountryCode.length :
"
+
JSON
.
stringify
(
countrylenth
));
expect
(
true
).
assertEqual
(
countrylenth
==
2
);
expect
(
true
).
assertEqual
(
countrylenth
==
2
);
let
WIDTH_20MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_20MHZ
;
let
WIDTH_20MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_20MHZ
;
console
.
info
(
"
[wifi_test]WIDTH_20MHZ :
"
+
JSON
.
stringify
(
WIDTH_20MHZ
));
console
.
info
(
"
[wifi_test]WIDTH_20MHZ :
"
+
JSON
.
stringify
(
WIDTH_20MHZ
));
expect
(
true
).
assertEqual
(
WIDTH_20MHZ
==
0
);
expect
(
true
).
assertEqual
(
WIDTH_20MHZ
==
0
);
let
WIDTH_40MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_40MHZ
;
let
WIDTH_40MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_40MHZ
;
console
.
info
(
"
[wifi_test]WIDTH_40MHZ :
"
+
JSON
.
stringify
(
WIDTH_40MHZ
));
console
.
info
(
"
[wifi_test]WIDTH_40MHZ :
"
+
JSON
.
stringify
(
WIDTH_40MHZ
));
expect
(
true
).
assertEqual
(
WIDTH_40MHZ
==
1
);
expect
(
true
).
assertEqual
(
WIDTH_40MHZ
==
1
);
let
WIDTH_80MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_80MHZ
;
let
WIDTH_80MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_80MHZ
;
console
.
info
(
"
[wifi_test]WIDTH_80MHZ :
"
+
JSON
.
stringify
(
WIDTH_80MHZ
));
console
.
info
(
"
[wifi_test]WIDTH_80MHZ :
"
+
JSON
.
stringify
(
WIDTH_80MHZ
));
expect
(
true
).
assertEqual
(
WIDTH_80MHZ
==
2
);
expect
(
true
).
assertEqual
(
WIDTH_80MHZ
==
2
);
let
WIDTH_160MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_160MHZ
;
let
WIDTH_160MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_160MHZ
;
console
.
info
(
"
[wifi_test]WIDTH_160MHZ :
"
+
JSON
.
stringify
(
WIDTH_160MHZ
));
console
.
info
(
"
[wifi_test]WIDTH_160MHZ :
"
+
JSON
.
stringify
(
WIDTH_160MHZ
));
expect
(
true
).
assertEqual
(
WIDTH_160MHZ
==
3
);
expect
(
true
).
assertEqual
(
WIDTH_160MHZ
==
3
);
let
WIDTH_80MHZ_PLUS
=
wifiMg
.
WifiChannelWidth
.
WIDTH_80MHZ_PLUS
;
let
WIDTH_80MHZ_PLUS
=
wifiMg
.
WifiChannelWidth
.
WIDTH_80MHZ_PLUS
;
console
.
info
(
"
[wifi_test]WIDTH_80MHZ_PLUS :
"
+
JSON
.
stringify
(
WIDTH_80MHZ_PLUS
));
console
.
info
(
"
[wifi_test]WIDTH_80MHZ_PLUS :
"
+
JSON
.
stringify
(
WIDTH_80MHZ_PLUS
));
expect
(
true
).
assertEqual
(
WIDTH_80MHZ_PLUS
==
4
);
expect
(
true
).
assertEqual
(
WIDTH_80MHZ_PLUS
==
4
);
let
WIDTH_INVALID
=
wifiMg
.
WifiChannelWidth
.
WIDTH_INVALID
;
let
WIDTH_INVALID
=
wifiMg
.
WifiChannelWidth
.
WIDTH_INVALID
;
console
.
info
(
"
[wifi_test]WIDTH_INVALID :
"
+
JSON
.
stringify
(
WIDTH_INVALID
));
console
.
info
(
"
[wifi_test]WIDTH_INVALID :
"
+
JSON
.
stringify
(
WIDTH_INVALID
));
expect
(
true
).
assertEqual
(
WIDTH_INVALID
==
5
);
expect
(
true
).
assertEqual
(
WIDTH_INVALID
==
5
);
})
})
/**
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0020
* @tc.number SUB_Communication_WiFi_XTS_Sta_0020
* @tc.name testFeatureSupported
* @tc.name testFeatureSupported
* @tc.desc Test FeatureSupported API function.
* @tc.desc Test FeatureSupported API function.
* @tc.type Function
* @tc.type Function
* @tc.level Level 3
* @tc.level Level 3
*/
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0020
'
,
0
,
function
()
{
it
(
'
SUB_Communication_WiFi_XTS_Sta_0020
'
,
0
,
function
()
{
expect
(
wifiMg
.
isWifiActive
()).
assertTrue
();
expect
(
wifiMg
.
isWifiActive
()).
assertTrue
();
let
wifiUtils
=
{
let
wifiUtils
=
{
WIFI_FEATURE_INFRA
:
0x0001
,
WIFI_FEATURE_INFRA
:
0x0001
,
WIFI_FEATURE_INFRA_5G
:
0x0002
,
WIFI_FEATURE_INFRA_5G
:
0x0002
,
WIFI_GAS_ANQP
:
0x0004
,
WIFI_GAS_ANQP
:
0x0004
,
WIFI_WIFI_DIRECT
:
0x0008
,
WIFI_WIFI_DIRECT
:
0x0008
,
WIFI_FEATURE_MOBILE_HOTSPOT
:
0x0010
,
WIFI_FEATURE_MOBILE_HOTSPOT
:
0x0010
,
WIFI_FEATURE_AWARE
:
0x0040
,
WIFI_FEATURE_AWARE
:
0x0040
,
WIFI_FEATURE_AP_STA
:
0x8000
,
WIFI_FEATURE_AP_STA
:
0x8000
,
WIFI_FEATURE_WPA3_SAE
:
0x8000000
,
WIFI_FEATURE_WPA3_SAE
:
0x8000000
,
WIFI_FEATURE_WPA3_SUITE_B
:
0x10000000
,
WIFI_FEATURE_WPA3_SUITE_B
:
0x10000000
,
WIFI_FEATURE_OWE
:
0x20000000
WIFI_FEATURE_OWE
:
0x20000000
}
}
let
isSupport1
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_INFRA
);
let
isSupport1
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_INFRA
);
console
.
info
(
"
[wifi_test] isFeatureSupported ->
"
+
isSupport1
);
console
.
info
(
"
[wifi_test] isFeatureSupported ->
"
+
isSupport1
);
let
isSupport2
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_INFRA_5G
);
let
isSupport2
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_INFRA_5G
);
console
.
info
(
"
[wifi_test] isFeatureSupported2 ->
"
+
isSupport2
);
console
.
info
(
"
[wifi_test] isFeatureSupported2 ->
"
+
isSupport2
);
let
isSupport3
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_GAS_ANQP
);
let
isSupport3
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_GAS_ANQP
);
console
.
info
(
"
[wifi_test] isFeatureSupported3 ->
"
+
isSupport3
);
console
.
info
(
"
[wifi_test] isFeatureSupported3 ->
"
+
isSupport3
);
let
isSupport4
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_WIFI_DIRECT
);
let
isSupport4
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_WIFI_DIRECT
);
console
.
info
(
"
[wifi_test] isFeatureSupported4 ->
"
+
isSupport4
);
console
.
info
(
"
[wifi_test] isFeatureSupported4 ->
"
+
isSupport4
);
let
isSupport5
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_MOBILE_HOTSPOT
);
let
isSupport5
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_MOBILE_HOTSPOT
);
console
.
info
(
"
[wifi_test] isFeatureSupported5 ->
"
+
isSupport5
);
console
.
info
(
"
[wifi_test] isFeatureSupported5 ->
"
+
isSupport5
);
let
isSupport6
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_AWARE
);
let
isSupport6
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_AWARE
);
console
.
info
(
"
[wifi_test] isFeatureSupported6 ->
"
+
isSupport6
);
console
.
info
(
"
[wifi_test] isFeatureSupported6 ->
"
+
isSupport6
);
let
isSupport7
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_AP_STA
);
let
isSupport7
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_AP_STA
);
console
.
info
(
"
[wifi_test] isFeatureSupported7 ->
"
+
isSupport7
);
console
.
info
(
"
[wifi_test] isFeatureSupported7 ->
"
+
isSupport7
);
let
isSupport8
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_WPA3_SAE
);
let
isSupport8
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_WPA3_SAE
);
console
.
info
(
"
[wifi_test] isFeatureSupported8 ->
"
+
isSupport8
);
console
.
info
(
"
[wifi_test] isFeatureSupported8 ->
"
+
isSupport8
);
let
isSupport9
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_WPA3_SUITE_B
);
let
isSupport9
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_WPA3_SUITE_B
);
console
.
info
(
"
[wifi_test] isFeatureSupported9 ->
"
+
isSupport9
);
console
.
info
(
"
[wifi_test] isFeatureSupported9 ->
"
+
isSupport9
);
let
isSupport
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_OWE
);
let
isSupport
=
wifiMg
.
isFeatureSupported
(
wifiUtils
.
WIFI_FEATURE_OWE
);
console
.
info
(
"
[wifi_test] isFeatureSupported ->
"
+
isSupport
);
console
.
info
(
"
[wifi_test] isFeatureSupported ->
"
+
isSupport
);
})
})
/**
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0004
* @tc.number SUB_Communication_WiFi_XTS_Sta_0004
* @tc.name testGetLinkedInfo
* @tc.name testGetLinkedInfo
* @tc.desc Test Test getLinkedInfo and getIpInfo information.
* @tc.desc Test Test getLinkedInfo and getIpInfo information.
* @tc.type Function
* @tc.type Function
* @tc.level Level 1
* @tc.level Level 1
*/
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0004
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_Communication_WiFi_XTS_Sta_0004
'
,
0
,
async
function
(
done
)
{
let
isConnectedResult
=
wifiMg
.
isConnected
();
let
isConnectedResult
=
wifiMg
.
isConnected
();
let
ipInfoResult
=
wifiMg
.
getIpInfo
();
let
ipInfoResult
=
wifiMg
.
getIpInfo
();
expect
(
JSON
.
stringify
(
ipInfoResult
)).
assertContain
(
"
gateway
"
);
expect
(
JSON
.
stringify
(
ipInfoResult
)).
assertContain
(
"
gateway
"
);
let
ipAddress
=
resolveIP
(
ipInfoResult
.
ipAddress
);
let
ipAddress
=
resolveIP
(
ipInfoResult
.
ipAddress
);
console
.
info
(
"
[wifi_test]ipAddress result:
"
+
ipAddress
);
console
.
info
(
"
[wifi_test]ipAddress result:
"
+
ipAddress
);
console
.
info
(
"
gateway:
"
+
ipInfoResult
.
gateway
+
"
ipAddress:
"
+
ipInfoResult
.
ipAddress
console
.
info
(
"
gateway:
"
+
ipInfoResult
.
gateway
+
"
ipAddress:
"
+
ipInfoResult
.
ipAddress
+
"
leaseDuration:
"
+
ipInfoResult
.
leaseDuration
+
+
"
leaseDuration:
"
+
ipInfoResult
.
leaseDuration
+
"
leaseDuration:
"
+
ipInfoResult
.
leaseDuration
+
"
leaseDuration:
"
+
ipInfoResult
.
leaseDuration
+
"
netmask:
"
+
ipInfoResult
.
netmask
+
"
primaryDns:
"
+
ipInfoResult
.
primaryDns
+
"
netmask:
"
+
ipInfoResult
.
netmask
+
"
primaryDns:
"
+
ipInfoResult
.
primaryDns
+
"
secondDns:
"
+
ipInfoResult
.
secondDns
+
"
serverIp:
"
+
ipInfoResult
.
serverIp
);
"
secondDns:
"
+
ipInfoResult
.
secondDns
+
"
serverIp:
"
+
ipInfoResult
.
serverIp
);
await
wifiMg
.
getLinkedInfo
()
await
wifiMg
.
getLinkedInfo
()
.
then
((
result
)
=>
{
.
then
((
result
)
=>
{
console
.
info
(
"
[wifi_test]get wifi link promise:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[wifi_test]get wifi link promise:
"
+
JSON
.
stringify
(
result
));
done
();
done
();
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[wifi_test]promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[wifi_test]promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
expect
().
assertFail
();
});
});
function
getLinked
(){
function
getLinked
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wifiMg
.
getLinkedInfo
(
wifiMg
.
getLinkedInfo
(
(
err
,
result
)
=>
{
(
err
,
result
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
"
[wifi_test]wifi getLinkedInfo failed
"
+
err
);
console
.
log
(
"
[wifi_test]wifi getLinkedInfo failed
"
+
err
);
}
}
let
clen
=
Object
.
keys
(
result
).
length
;
let
clen
=
Object
.
keys
(
result
).
length
;
expect
(
clen
).
assertLarger
(
0
);
expect
(
clen
).
assertLarger
(
0
);
console
.
info
(
"
[wifi_test]getLinkedInfo callback result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[wifi_test]getLinkedInfo callback result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
ssid:
"
+
result
.
ssid
+
"
bssid:
"
+
result
.
bssid
+
"
band:
"
+
result
.
band
+
console
.
info
(
"
ssid:
"
+
result
.
ssid
+
"
bssid:
"
+
result
.
bssid
+
"
band:
"
+
result
.
band
+
"
isHidden:
"
+
result
.
isHidden
+
"
isRestricted:
"
+
result
.
isRestricted
+
"
isHidden:
"
+
result
.
isHidden
+
"
isRestricted:
"
+
result
.
isRestricted
+
"
chload:
"
+
result
.
chload
+
"
rssi
"
+
result
.
rssi
+
"
netWorkId:
"
+
result
.
netWorkId
+
"
chload:
"
+
result
.
chload
+
"
rssi
"
+
result
.
rssi
+
"
netWorkId:
"
+
result
.
netWorkId
+
"
linkSpeed:
"
+
result
.
linkSpeed
+
"
frequency:
"
"
linkSpeed:
"
+
result
.
linkSpeed
+
"
frequency:
"
+
result
.
frequency
+
"
snr:
"
+
result
.
snr
+
+
result
.
frequency
+
"
snr:
"
+
result
.
snr
+
"
macAddress:
"
+
result
.
macAddress
+
"
ipAddress:
"
+
result
.
ipAddress
+
"
macAddress:
"
+
result
.
macAddress
+
"
ipAddress:
"
+
result
.
ipAddress
+
"
suppState:
"
+
result
.
suppState
+
"
connState:
"
+
result
.
connState
"
suppState:
"
+
result
.
suppState
+
"
connState:
"
+
result
.
connState
+
"
macType:
"
+
result
.
macType
+
"
rxLinkSpeed:
"
+
result
.
rxLinkSpeed
+
"
macType:
"
+
result
.
macType
+
"
rxLinkSpeed:
"
+
result
.
rxLinkSpeed
+
"
maxSupportedTxLinkSpeed:
"
+
result
.
maxSupportedTxLinkSpeed
+
"
maxSupportedTxLinkSpeed:
"
+
result
.
maxSupportedTxLinkSpeed
+
"
maxSupportedRxLinkSpeed:
"
+
result
.
maxSupportedRxLinkSpeed
+
"
maxSupportedRxLinkSpeed:
"
+
result
.
maxSupportedRxLinkSpeed
+
"
wifiStandard:
"
+
result
.
wifiStandard
);
+
"
wifiStandard:
"
+
result
.
wifiStandard
);
let
standard
=
wifiMg
.
getLinkedInfo
().
WifiStandard
;
let
standard
=
wifiMg
.
getLinkedInfo
().
WifiStandard
;
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_UNDEFINED
)
{
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_UNDEFINED
)
{
expect
(
true
).
assertEqual
(
standard
==
0
);
expect
(
true
).
assertEqual
(
standard
==
0
);
}
}
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11A
)
{
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11A
)
{
expect
(
true
).
assertEqual
(
standard
==
1
);
expect
(
true
).
assertEqual
(
standard
==
1
);
}
}
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11B
)
{
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11B
)
{
expect
(
true
).
assertEqual
(
standard
==
2
);
expect
(
true
).
assertEqual
(
standard
==
2
);
}
}
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11G
)
{
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11G
)
{
expect
(
true
).
assertEqual
(
standard
==
3
);
expect
(
true
).
assertEqual
(
standard
==
3
);
}
}
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11N
)
{
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11N
)
{
expect
(
true
).
assertEqual
(
standard
==
4
);
expect
(
true
).
assertEqual
(
standard
==
4
);
}
}
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11AC
)
{
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11AC
)
{
expect
(
true
).
assertEqual
(
standard
==
5
);
expect
(
true
).
assertEqual
(
standard
==
5
);
}
}
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11AX
)
{
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11AX
)
{
expect
(
true
).
assertEqual
(
standard
==
6
);
expect
(
true
).
assertEqual
(
standard
==
6
);
}
}
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11AD
)
{
if
(
standard
==
wifiMg
.
WifiStandard
.
WIFI_STANDARD_11AD
)
{
expect
(
true
).
assertEqual
(
standard
==
7
);
expect
(
true
).
assertEqual
(
standard
==
7
);
}
}
let
state
=
wifiMg
.
getLinkedInfo
().
ConnState
;
let
state
=
wifiMg
.
getLinkedInfo
().
ConnState
;
if
(
state
==
wifiMg
.
ConnState
.
SCANNING
)
{
if
(
state
==
wifiMg
.
ConnState
.
SCANNING
)
{
expect
(
true
).
assertEqual
(
state
==
0
);
expect
(
true
).
assertEqual
(
state
==
0
);
}
}
if
(
state
==
wifiMg
.
ConnState
.
CONNECTING
)
{
if
(
state
==
wifiMg
.
ConnState
.
CONNECTING
)
{
expect
(
true
).
assertEqual
(
state
==
1
);
expect
(
true
).
assertEqual
(
state
==
1
);
}
}
if
(
state
==
wifiMg
.
ConnState
.
AUTHENTICATING
)
{
if
(
state
==
wifiMg
.
ConnState
.
AUTHENTICATING
)
{
expect
(
true
).
assertEqual
(
state
==
2
);
expect
(
true
).
assertEqual
(
state
==
2
);
}
}
if
(
state
==
wifiMg
.
ConnState
.
OBTAINING_IPADDR
)
{
if
(
state
==
wifiMg
.
ConnState
.
OBTAINING_IPADDR
)
{
expect
(
true
).
assertEqual
(
state
==
3
);
expect
(
true
).
assertEqual
(
state
==
3
);
}
}
if
(
state
==
wifiMg
.
ConnState
.
CONNECTED
)
{
if
(
state
==
wifiMg
.
ConnState
.
CONNECTED
)
{
expect
(
true
).
assertEqual
(
state
==
4
);
expect
(
true
).
assertEqual
(
state
==
4
);
}
}
if
(
state
==
wifiMg
.
ConnState
.
DISCONNECTING
)
{
if
(
state
==
wifiMg
.
ConnState
.
DISCONNECTING
)
{
expect
(
true
).
assertEqual
(
state
==
5
);
expect
(
true
).
assertEqual
(
state
==
5
);
}
}
if
(
state
==
wifiMg
.
ConnState
.
DISCONNECTED
)
{
if
(
state
==
wifiMg
.
ConnState
.
DISCONNECTED
)
{
expect
(
true
).
assertEqual
(
state
==
6
);
expect
(
true
).
assertEqual
(
state
==
6
);
}
}
if
(
state
==
wifiMg
.
ConnState
.
UNKNOWN
)
{
if
(
state
==
wifiMg
.
ConnState
.
UNKNOWN
)
{
expect
(
true
).
assertEqual
(
state
==
7
);
expect
(
true
).
assertEqual
(
state
==
7
);
}
}
resolve
();
resolve
();
});
});
});
});
}
}
await
getLinked
();
await
getLinked
();
done
();
done
();
})
})
/**
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0034
* @tc.number SUB_Communication_WiFi_XTS_Sta_0034
* @tc.name testgetScanResultsSync
* @tc.name testgetScanResultsSync
* @tc.desc Test getScanResults Sync API functionality.
* @tc.desc Test getScanResults Sync API functionality.
* @tc.type Function
* @tc.type Function
* @tc.level Level 0
* @tc.level Level 0
*/
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0034
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_Communication_WiFi_XTS_Sta_0034
'
,
0
,
async
function
(
done
)
{
let
scanResult
=
wifiMg
.
scan
();
let
scanResult
=
wifiMg
.
scan
();
await
sleep
(
3000
);
await
sleep
(
3000
);
let
getScanInfoListResult
=
wifiMg
.
getScanInfoList
();
let
getScanInfoListResult
=
wifiMg
.
getScanResultsSync
();
console
.
info
(
"
[wifi_test]wifi getScanInfoList result :
"
+
JSON
.
stringify
(
getScanInfoListResult
));
console
.
info
(
"
[wifi_test]wifi getScanInfoList result :
"
+
JSON
.
stringify
(
getScanInfoListResult
));
let
clen
=
Object
.
keys
(
getScanInfoListResult
).
length
;
let
getScanInfoResult
=
wifiMg
.
getScanInfoList
();
console
.
info
(
"
[wifi_test]wifi getScanInfoList length result :
"
+
JSON
.
stringify
(
clen
));
console
.
info
(
"
[wifi_test]wifi getScanInfoList result :
"
+
JSON
.
stringify
(
getScanInfoResult
));
let
result
=
getScanInfoListResult
;
let
clen
=
Object
.
keys
(
getScanInfoListResult
).
length
;
if
(
clen
>=
0
)
{
console
.
info
(
"
[wifi_test]wifi getScanInfoList length result :
"
+
JSON
.
stringify
(
clen
));
expect
(
true
).
assertEqual
(
clen
>=
0
);
let
result
=
getScanInfoListResult
;
for
(
let
j
=
0
;
j
<
clen
;
++
j
)
{
if
(
clen
>=
0
)
{
console
.
info
(
"
ssid:
"
+
result
[
j
].
ssid
+
"
bssid:
"
+
result
[
j
].
bssid
+
expect
(
true
).
assertEqual
(
clen
>=
0
);
"
securityType:
"
+
result
[
j
].
securityType
+
for
(
let
j
=
0
;
j
<
clen
;
++
j
)
{
"
rssi:
"
+
result
[
j
].
rssi
+
"
band:
"
+
result
[
j
].
band
+
console
.
info
(
"
ssid:
"
+
result
[
j
].
ssid
+
"
bssid:
"
+
result
[
j
].
bssid
+
"
frequency:
"
+
result
[
j
].
frequency
+
"
channelWidth:
"
+
result
[
j
].
channelWidth
+
"
bssidType:
"
+
result
[
j
].
bssidType
+
"
timestamp
"
+
result
[
j
].
timestamp
+
"
capabilities
"
+
result
[
j
].
capabilities
"
securityType:
"
+
result
[
j
].
securityType
+
+
"
centerFrequency0:
"
+
result
[
j
].
centerFrequency0
"
rssi:
"
+
result
[
j
].
rssi
+
"
band:
"
+
result
[
j
].
band
+
+
"
centerFrequency1:
"
+
result
[
j
].
centerFrequency1
"
frequency:
"
+
result
[
j
].
frequency
+
"
channelWidth:
"
+
result
[
j
].
channelWidth
+
+
"
eid:
"
+
result
[
j
].
infoElems
.
eid
+
"
content:
"
+
result
[
j
].
infoElems
.
content
);
"
timestamp
"
+
result
[
j
].
timestamp
+
"
capabilities
"
+
result
[
j
].
capabilities
}
+
"
centerFrequency0:
"
+
result
[
j
].
centerFrequency0
}
+
"
centerFrequency1:
"
+
result
[
j
].
centerFrequency1
done
();
+
"
eid:
"
+
result
[
j
].
infoElems
.
eid
+
"
content:
"
+
result
[
j
].
infoElems
.
content
);
})
}
}
done
();
})
/**
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0035
* @tc.number SUB_Communication_WiFi_XTS_Sta_0035
* @tc.name testisBandTypeSupported
* @tc.name testisBandTypeSupported
* @tc.desc Test isBandTypeSupported API functionality.
* @tc.desc Test isBandTypeSupported API functionality.
* @tc.type Function
* @tc.type Function
* @tc.level Level 0
* @tc.level Level 0
*/
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0035
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_Communication_WiFi_XTS_Sta_0035
'
,
0
,
async
function
(
done
)
{
try
{
try
{
let
isBandTypeSupported
=
wifiMg
.
isBandTypeSupported
(
wifiMg
.
WifiBandType
.
WIFI_BAND_NONE
);
let
isBandTypeSupported
=
wifiMg
.
isBandTypeSupported
(
wifiMg
.
WifiBandType
.
WIFI_BAND_NONE
);
...
@@ -358,7 +361,67 @@ export default function actsWifiManagerFunctionsTest() {
...
@@ -358,7 +361,67 @@ export default function actsWifiManagerFunctionsTest() {
expect
(
typeof
(
isBandTypeSupported4
)).
assertEqual
(
'
boolean
'
);
expect
(
typeof
(
isBandTypeSupported4
)).
assertEqual
(
'
boolean
'
);
done
();
done
();
})
})
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0036
* @tc.name testgetScanResults
* @tc.desc Test getScanResults promise and callback API functionality.
* @tc.type Function
* @tc.level Level 0
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0036
'
,
0
,
async
function
(
done
)
{
await
wifiMg
.
getScanResults
()
.
then
(
result
=>
{
let
clen
=
Object
.
keys
(
result
).
length
;
expect
(
true
).
assertEqual
(
clen
>=
0
);
console
.
info
(
"
[wifi_test]getScanResults promise result:
"
+
JSON
.
stringify
(
result
));
});
function
getScan
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wifiMg
.
getScanResults
(
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
log
(
"
[wifi_test] wifi getScanResults failed:
"
+
err
);
}
let
clen
=
Object
.
keys
(
result
).
length
;
if
(
!
(
clen
==
0
))
{
expect
(
clen
).
assertLarger
(
0
);
console
.
info
(
"
[wifi_test] getScanResults callback result:
"
+
JSON
.
stringify
(
result
));
for
(
let
j
=
0
;
j
<
clen
;
++
j
)
{
console
.
info
(
"
ssid:
"
+
result
[
j
].
ssid
+
"
bssid:
"
+
result
[
j
].
bssid
+
"
securityType:
"
+
result
[
j
].
securityType
+
"
rssi:
"
+
result
[
j
].
rssi
+
"
band:
"
+
result
[
j
].
band
+
"
frequency:
"
+
result
[
j
].
frequency
+
"
channelWidth:
"
+
result
[
j
].
channelWidth
+
"
timestamp
"
+
result
[
j
].
timestamp
+
"
capabilities
"
+
result
[
j
].
capabilities
);
}
}
resolve
();
});
});
}
await
getScan
();
done
();
})
/**
* @tc.number Communication_WiFi_XTS_Sta_0037
* @tc.name testgetIpv6Info
* @tc.desc Test getIpv6Info API functionality.
* @tc.type Function
* @tc.level Level 0
*/
it
(
'
Communication_WiFi_XTS_Sta_0037
'
,
0
,
function
()
{
let
ipv6InfoResult
=
wifiMg
.
getIpv6Info
();
console
.
info
(
"
[wifi_test]ipv6InfoResult.
"
+
JSON
.
stringify
(
ipv6InfoResult
));
expect
(
JSON
.
stringify
(
ipv6InfoResult
)).
assertContain
(
"
gateway
"
);
console
.
info
(
"
linkIpv6Address:
"
+
ipv6InfoResult
.
linkIpv6Address
+
"
globalIpv6Address:
"
+
ipv6InfoResult
.
globalIpv6Address
+
"
randomGlobalIpv6Address:
"
+
ipv6InfoResult
.
randomGlobalIpv6Address
+
"
gateway:
"
+
ipv6InfoResult
.
gateway
+
"
netmask:
"
+
ipv6InfoResult
.
netmask
+
"
primaryDns:
"
+
ipv6InfoResult
.
primaryDNS
+
"
secondDns:
"
+
ipv6InfoResult
.
secondDNS
);
})
console
.
log
(
"
*************[wifi_test] start wifi js unit test end*************
"
);
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录