Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
cb135430
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看板
提交
cb135430
编写于
3月 01, 2023
作者:
Q
quanli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
quanli1@huawei.com
Signed-off-by:
N
quanli
<
quanli1@huawei.com
>
上级
9194ac45
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
121 addition
and
141 deletion
+121
-141
communication/wifi_p2p/src/main/js/test/WifiManagerP2PEvent.test.js
...ion/wifi_p2p/src/main/js/test/WifiManagerP2PEvent.test.js
+6
-6
communication/wifi_p2p/src/main/js/test/WifiManagerP2PFunction.test.js
.../wifi_p2p/src/main/js/test/WifiManagerP2PFunction.test.js
+77
-63
communication/wifi_p2p/src/main/js/test/WifiP2PFunction.test.js
...ication/wifi_p2p/src/main/js/test/WifiP2PFunction.test.js
+8
-2
communication/wifi_standard/src/main/js/test/WifiCandidateNetWork.test.js
...fi_standard/src/main/js/test/WifiCandidateNetWork.test.js
+0
-1
communication/wifi_standard/src/main/js/test/WifiManagerCandidateNetWork.test.js
...dard/src/main/js/test/WifiManagerCandidateNetWork.test.js
+0
-2
communication/wifi_standard/src/main/js/test/WifiManagerStationEvent.test.js
...standard/src/main/js/test/WifiManagerStationEvent.test.js
+0
-1
communication/wifi_standard/src/main/js/test/WifiManagerStationFunctions.test.js
...dard/src/main/js/test/WifiManagerStationFunctions.test.js
+29
-61
communication/wifi_standard/src/main/js/test/WifiStationEvent.test.js
...n/wifi_standard/src/main/js/test/WifiStationEvent.test.js
+1
-2
communication/wifi_standard/src/main/js/test/WifiStationFunctions.test.js
...fi_standard/src/main/js/test/WifiStationFunctions.test.js
+0
-3
未找到文件。
communication/wifi_p2p/src/main/js/test/WifiManagerP2PEvent.test.js
浏览文件 @
cb135430
...
...
@@ -87,7 +87,7 @@ export default function actsWifiManagerEventTest() {
});
await
sleep
(
2000
);
wifiMg
.
off
(
p2pConnectionState
,
p2pConnectionChangeCallback
);
let
remove
GroupResult
=
wifiMg
.
remove
Group
();
let
remove
P2pGroupResult
=
wifiMg
.
removeP2p
Group
();
done
();
})
...
...
@@ -122,9 +122,9 @@ export default function actsWifiManagerEventTest() {
console
.
info
(
"
[wifi_test]p2pPeerDeviceChange callback, result:
"
+
JSON
.
stringify
(
result
));
}
wifiMg
.
on
(
p2pPeerDeviceState
,
p2pPeerDeviceChangeCallback
);
let
startDiscover
=
wifiMg
.
startDiscoverDevices
();
let
startDiscover
=
wifiMg
.
startDiscover
P2p
Devices
();
await
sleep
(
3000
);
let
stopDiscover
=
wifiMg
.
stopDiscoverDevices
();
let
stopDiscover
=
wifiMg
.
stopDiscover
P2p
Devices
();
wifiMg
.
off
(
p2pPeerDeviceState
,
p2pPeerDeviceChangeCallback
);
done
();
})
...
...
@@ -149,7 +149,7 @@ export default function actsWifiManagerEventTest() {
groupName
:
"
AAAZZZ123
"
,
goBand
:
wifiMg
.
GroupOwnerBand
.
GO_BAND_AUTO
,
};
let
create
GroupResult
=
wifiMg
.
create
Group
(
WifiP2PConfig
);
let
create
P2pGroupResult
=
wifiMg
.
createP2p
Group
(
WifiP2PConfig
);
await
(
2000
);
try
{
await
wifiMg
.
getCurrentP2pGroup
()
...
...
@@ -182,9 +182,9 @@ export default function actsWifiManagerEventTest() {
console
.
info
(
"
[wifi_test]p2pDiscoveryChange callback, result:
"
+
JSON
.
stringify
(
result
));
}
wifiMg
.
on
(
p2pPeerDeviceState
,
p2pDiscoveryChangeCallback
);
let
startDiscover
=
wifiMg
.
startDiscoverDevices
();
let
startDiscover
=
wifiMg
.
startDiscover
P2p
Devices
();
await
sleep
(
3000
);
let
stopDiscover
=
wifiMg
.
stopDiscoverDevices
();
let
stopDiscover
=
wifiMg
.
stopDiscover
P2p
Devices
();
wifiMg
.
off
(
p2pPeerDeviceState
,
p2pDiscoveryChangeCallback
);
done
();
})
...
...
communication/wifi_p2p/src/main/js/test/WifiManagerP2PFunction.test.js
浏览文件 @
cb135430
...
...
@@ -37,8 +37,8 @@ export default function actsWifiManagerFunctionTest() {
/**
* @tc.number SUB_Communication_WiFi_XTS_P2P_0003
* @tc.name test
Create
Group
* @tc.desc Test createGroup and getCurrentP2pGroup API Function
* @tc.name test
createP2p
Group
* @tc.desc Test create
P2p
Group and getCurrentP2pGroup API Function
* @tc.type Function
* @tc.level Level 3
*/
...
...
@@ -52,7 +52,7 @@ export default function actsWifiManagerFunctionTest() {
};
console
.
log
(
"
[wifi_test]check the state of wifi:
"
+
wifiMg
.
isWifiActive
());
expect
(
wifiMg
.
isWifiActive
()).
assertTrue
();
let
create
GroupResult
=
wifiMg
.
create
Group
(
wifiP2PConfig
);
let
create
P2pGroupResult
=
wifiMg
.
createP2p
Group
(
wifiP2PConfig
);
await
sleep
(
2000
);
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
...
...
@@ -84,7 +84,7 @@ export default function actsWifiManagerFunctionTest() {
});
}
await
getCurrentP2pGroupResult
();
let
remove
GroupResult
=
wifiMg
.
remove
Group
();
let
remove
P2pGroupResult
=
wifiMg
.
removeP2p
Group
();
await
sleep
(
2000
);
try
{
await
wifiMg
.
getCurrentP2pGroup
()
...
...
@@ -104,8 +104,8 @@ export default function actsWifiManagerFunctionTest() {
/**
* @tc.number SUB_Communication_WiFi_XTS_P2P_0004
* @tc.name test
Create
Group
* @tc.desc Test createGroup-Setting a 7-bit Key Function.
* @tc.name test
createP2p
Group
* @tc.desc Test create
P2p
Group-Setting a 7-bit Key Function.
* @tc.type Function
* @tc.level Level 3
*/
...
...
@@ -119,14 +119,17 @@ export default function actsWifiManagerFunctionTest() {
groupName
:
"
test_pass
"
,
goBand
:
wifiMg
.
GroupOwnerBand
.
GO_BAND_2GHZ
,
};
let
create
GroupResult
=
wifiMg
.
create
Group
(
wifiP2PConfig
);
let
create
P2pGroupResult
=
wifiMg
.
createP2p
Group
(
wifiP2PConfig
);
await
sleep
(
2000
);
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test] getCurrentP2pGroup promise result :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
networkId
==
-
999
);
}).
catch
((
error
)
=>
{
console
.
error
(
'
[wifi_test] getCurrentP2pGroup promise failed :
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
});
let
remove
GroupResult
=
wifiMg
.
remove
Group
();
let
remove
P2pGroupResult
=
wifiMg
.
removeP2p
Group
();
await
sleep
(
2000
);
try
{
await
wifiMg
.
getCurrentP2pGroup
()
...
...
@@ -134,7 +137,7 @@ export default function actsWifiManagerFunctionTest() {
console
.
info
(
"
[wifi_test] getCurrentP2pGroup promise result1 :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
deviceName
==
null
);
}).
catch
((
error
)
=>
{
console
.
error
(
'
[wifi_test] getCurrentP2pGroup promise failed :
'
+
JSON
.
stringify
(
error
));
console
.
error
(
'
[wifi_test] getCurrentP2pGroup promise failed
1
:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
});
}
catch
(
error
){
...
...
@@ -146,8 +149,8 @@ export default function actsWifiManagerFunctionTest() {
/**
* @tc.number SUB_Communication_WiFi_XTS_P2P_0104
* @tc.name test
Create
Group
* @tc.desc Test createGroup-Key setting: Chinese, English, and characters Function.
* @tc.name test
createP2p
Group
* @tc.desc Test create
P2p
Group-Key setting: Chinese, English, and characters Function.
* @tc.type Function
* @tc.level Level 3
*/
...
...
@@ -161,14 +164,14 @@ export default function actsWifiManagerFunctionTest() {
groupName
:
"
test_pass1
"
,
goBand
:
wifiMg
.
GroupOwnerBand
.
GO_BAND_2GHZ
,
};
let
create
GroupResult
=
wifiMg
.
create
Group
(
wifiP2PConfig
);
let
create
P2pGroupResult
=
wifiMg
.
createP2p
Group
(
wifiP2PConfig
);
await
sleep
(
2000
);
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test]getCurrentP2pGroup promise result :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
passphrase
==
wifiP2PConfig
.
passphrase
);
});
let
remove
GroupResult
=
wifiMg
.
remove
Group
();
let
remove
P2pGroupResult
=
wifiMg
.
removeP2p
Group
();
await
sleep
(
2000
);
try
{
await
wifiMg
.
getCurrentP2pGroup
()
...
...
@@ -188,8 +191,8 @@ export default function actsWifiManagerFunctionTest() {
/**
* @tc.number SUB_Communication_WiFi_XTS_P2P_0204
* @tc.name test
Create
Group
* @tc.desc Test createGroup-Key setting 64 bit Function.
* @tc.name test
createP2p
Group
* @tc.desc Test create
P2p
Group-Key setting 64 bit Function.
* @tc.type Function
* @tc.level Level 3
*/
...
...
@@ -203,14 +206,14 @@ export default function actsWifiManagerFunctionTest() {
groupName
:
"
test_pass2
"
,
goBand
:
wifiMg
.
GroupOwnerBand
.
GO_BAND_2GHZ
,
};
let
create
GroupResult
=
wifiMg
.
create
Group
(
wifiP2PConfig
);
let
create
P2pGroupResult
=
wifiMg
.
createP2p
Group
(
wifiP2PConfig
);
await
sleep
(
2000
);
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test]getCurrentP2pGroup promise result :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
passphrase
==
wifiP2PConfig
.
passphrase
);
});
let
remove
GroupResult
=
wifiMg
.
remove
Group
();
let
remove
P2pGroupResult
=
wifiMg
.
removeP2p
Group
();
await
sleep
(
2000
);
try
{
await
wifiMg
.
getCurrentP2pGroup
()
...
...
@@ -230,8 +233,8 @@ export default function actsWifiManagerFunctionTest() {
/**
* @tc.number SUB_Communication_WiFi_XTS_P2P_0304
* @tc.name test
Create
Group
* @tc.desc Test createGroup-Key setting 65 bitsFunction.
* @tc.name test
createP2p
Group
* @tc.desc Test create
P2p
Group-Key setting 65 bitsFunction.
* @tc.type Function
* @tc.level Level 3
*/
...
...
@@ -245,14 +248,17 @@ export default function actsWifiManagerFunctionTest() {
groupName
:
"
test_pass3
"
,
goBand
:
wifiMg
.
GroupOwnerBand
.
GO_BAND_2GHZ
,
};
let
create
GroupResult
=
wifiMg
.
create
Group
(
wifiP2PConfig
);
let
create
P2pGroupResult
=
wifiMg
.
createP2p
Group
(
wifiP2PConfig
);
await
sleep
(
2000
);
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test]getCurrentP2pGroup promise result :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
passphrase
!=
wifiP2PConfig
.
passphrase
);
}).
catch
((
error
)
=>
{
console
.
error
(
'
[wifi_test] getCurrentP2pGroup promise failed :
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
});
let
remove
GroupResult
=
wifiMg
.
remove
Group
();
let
remove
P2pGroupResult
=
wifiMg
.
removeP2p
Group
();
await
sleep
(
2000
);
try
{
await
wifiMg
.
getCurrentP2pGroup
()
...
...
@@ -260,7 +266,7 @@ export default function actsWifiManagerFunctionTest() {
console
.
info
(
"
[wifi_test] getCurrentP2pGroup promise result1 :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
deviceName
==
null
);
}).
catch
((
error
)
=>
{
console
.
error
(
'
[wifi_test] getCurrentP2pGroup promise failed :
'
+
JSON
.
stringify
(
error
));
console
.
error
(
'
[wifi_test] getCurrentP2pGroup promise failed
1
:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
});
}
catch
(
error
){
...
...
@@ -272,8 +278,8 @@ export default function actsWifiManagerFunctionTest() {
/**
* @tc.number SUB_Communication_WiFi_XTS_P2P_0007
* @tc.name test
Create
Group
* @tc.desc Test createGroup-2.4 GHz frequency band setting Function
* @tc.name test
createP2p
Group
* @tc.desc Test create
P2p
Group-2.4 GHz frequency band setting Function
* @tc.type Function
* @tc.level Level 0
*/
...
...
@@ -287,14 +293,14 @@ export default function actsWifiManagerFunctionTest() {
groupName
:
"
test_band1
"
,
goBand
:
wifiMg
.
GroupOwnerBand
.
GO_BAND_2GHZ
,
};
let
create
GroupResult
=
wifiMg
.
create
Group
(
wifiP2PConfig
);
let
create
P2pGroupResult
=
wifiMg
.
createP2p
Group
(
wifiP2PConfig
);
await
sleep
(
2000
);
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test]getCurrentP2pGroup promise result :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
2412
<
data
.
frequency
<
2484
);
});
let
remove
GroupResult
=
wifiMg
.
remove
Group
();
let
remove
P2pGroupResult
=
wifiMg
.
removeP2p
Group
();
await
sleep
(
2000
);
try
{
await
wifiMg
.
getCurrentP2pGroup
()
...
...
@@ -314,8 +320,8 @@ export default function actsWifiManagerFunctionTest() {
/**
* @tc.number SUB_Communication_WiFi_XTS_P2P_0107
* @tc.name test
Create
Group
* @tc.desc Test createGroup-5 GHz frequency band setting Function
* @tc.name test
createP2p
Group
* @tc.desc Test create
P2p
Group-5 GHz frequency band setting Function
* @tc.type Function
* @tc.level Level 0
*/
...
...
@@ -330,14 +336,14 @@ export default function actsWifiManagerFunctionTest() {
groupName
:
"
test_band2
"
,
goBand
:
wifiMg
.
GroupOwnerBand
.
GO_BAND_5GHZ
,
};
let
create
GroupResult
=
wifiMg
.
create
Group
(
wifiP2PConfig
);
let
create
P2pGroupResult
=
wifiMg
.
createP2p
Group
(
wifiP2PConfig
);
await
sleep
(
2000
);
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test] getCurrentP2pGroup promise result :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
5160
<
data
.
frequency
<
5865
);
});
let
remove
GroupResult
=
await
wifiMg
.
remove
Group
();
let
remove
P2pGroupResult
=
await
wifiMg
.
removeP2p
Group
();
await
sleep
(
2000
);
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
...
...
@@ -348,7 +354,7 @@ export default function actsWifiManagerFunctionTest() {
expect
(
true
).
assertEqual
(
error
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[wifi_test]createGroup 5G goBand result :
"
+
JSON
.
stringify
(
error
.
message
));
console
.
info
(
"
[wifi_test]create
P2p
Group 5G goBand result :
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
...
...
@@ -356,8 +362,8 @@ export default function actsWifiManagerFunctionTest() {
/**
* @tc.number SUB_Communication_WiFi_XTS_P2P_0207
* @tc.name test
Create
Group
* @tc.desc Test createGroup-Auto frequency band setting Function
* @tc.name test
createP2p
Group
* @tc.desc Test create
P2p
Group-Auto frequency band setting Function
* @tc.type Function
* @tc.level Level 0
*/
...
...
@@ -372,14 +378,14 @@ export default function actsWifiManagerFunctionTest() {
groupName
:
"
test_band3
"
,
goBand
:
wifiMg
.
GroupOwnerBand
.
GO_BAND_AUTO
,
};
let
create
GroupResult
=
wifiMg
.
create
Group
(
wifiP2PConfig
);
let
create
P2pGroupResult
=
wifiMg
.
createP2p
Group
(
wifiP2PConfig
);
await
sleep
(
2000
);
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test]getCurrentP2pGroup promise result :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
frequency
!=
null
);
});
let
remove
GroupResult
=
await
wifiMg
.
remove
Group
();
let
remove
P2pGroupResult
=
await
wifiMg
.
removeP2p
Group
();
await
sleep
(
2000
);
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
...
...
@@ -390,7 +396,7 @@ export default function actsWifiManagerFunctionTest() {
expect
(
true
).
assertEqual
(
error
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[wifi_test]createGroup auto goBand result :
"
+
JSON
.
stringify
(
error
.
message
));
console
.
info
(
"
[wifi_test]create
P2p
Group auto goBand result :
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
...
...
@@ -398,8 +404,8 @@ export default function actsWifiManagerFunctionTest() {
/**
* @tc.number SUB_Communication_WiFi_XTS_P2P_0008
* @tc.name test
Create
Group
* @tc.desc Test createGroup-SSID is an empty string Function.
* @tc.name test
createP2p
Group
* @tc.desc Test create
P2p
Group-SSID is an empty string Function.
* @tc.type Function
* @tc.level Level 0
*/
...
...
@@ -414,13 +420,13 @@ export default function actsWifiManagerFunctionTest() {
groupName
:
""
,
goBand
:
wifiMg
.
GroupOwnerBand
.
GO_BAND_2GHZ
,
};
let
create
GroupResult
=
wifi
.
create
Group
(
wifiP2PConfig
);
let
create
P2pGroupResult
=
wifi
.
createP2p
Group
(
wifiP2PConfig
);
await
sleep
(
2000
);
await
wifi
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test]getCurrentP2pGroup promise result :
"
+
JSON
.
stringify
(
data
));
});
let
remove
GroupResult
=
wifi
.
remove
Group
();
let
remove
P2pGroupResult
=
wifi
.
removeP2p
Group
();
await
sleep
(
2000
);
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
...
...
@@ -431,7 +437,7 @@ export default function actsWifiManagerFunctionTest() {
expect
(
true
).
assertEqual
(
error
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[wifi_test]createGroup error passphrase result :
"
+
JSON
.
stringify
(
error
.
message
));
console
.
info
(
"
[wifi_test]create
P2p
Group error passphrase result :
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
...
...
@@ -439,8 +445,8 @@ export default function actsWifiManagerFunctionTest() {
/**
* @tc.number SUB_Communication_WiFi_XTS_P2P_0108
* @tc.name test
Create
Group
* @tc.desc Test createGroup-SSID is a space Function.
* @tc.name test
createP2p
Group
* @tc.desc Test create
P2p
Group-SSID is a space Function.
* @tc.type Function
* @tc.level Level 0
*/
...
...
@@ -455,13 +461,13 @@ export default function actsWifiManagerFunctionTest() {
groupName
:
"
"
,
goBand
:
wifiMg
.
GroupOwnerBand
.
GO_BAND_2GHZ
,
};
let
create
GroupResult
=
wifi
.
create
Group
(
wifiP2PConfig
);
let
create
P2pGroupResult
=
wifi
.
createP2p
Group
(
wifiP2PConfig
);
await
sleep
(
2000
);
await
wifi
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test]getCurrentP2pGroup promise result :
"
+
JSON
.
stringify
(
data
));
});
let
remove
GroupResult
=
wifi
.
remove
Group
();
let
remove
P2pGroupResult
=
wifi
.
removeP2p
Group
();
await
sleep
(
2000
);
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
...
...
@@ -472,7 +478,7 @@ export default function actsWifiManagerFunctionTest() {
expect
(
true
).
assertEqual
(
error
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[wifi_test]createGroup error passphrase result :
"
+
JSON
.
stringify
(
error
.
message
));
console
.
info
(
"
[wifi_test]create
P2p
Group error passphrase result :
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
...
...
@@ -480,8 +486,8 @@ export default function actsWifiManagerFunctionTest() {
/**
* @tc.number SUB_Communication_WiFi_XTS_P2P_0308
* @tc.name test
Create
Group
* @tc.desc Test createGroup-the password must be a space.
* @tc.name test
createP2p
Group
* @tc.desc Test create
P2p
Group-the password must be a space.
* @tc.type Function
* @tc.level Level 0
*/
...
...
@@ -496,13 +502,13 @@ export default function actsWifiManagerFunctionTest() {
groupName
:
"
testpassword
"
,
goBand
:
wifiMg
.
GroupOwnerBand
.
GO_BAND_2GHZ
,
};
let
create
GroupResult
=
wifi
.
create
Group
(
wifiP2PConfig
);
let
create
P2pGroupResult
=
wifi
.
createP2p
Group
(
wifiP2PConfig
);
await
sleep
(
2000
);
await
wifi
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test] getCurrentP2pGroup promise result :
"
+
JSON
.
stringify
(
data
));
});
let
remove
GroupResult
=
wifi
.
remove
Group
();
let
remove
P2pGroupResult
=
wifi
.
removeP2p
Group
();
await
sleep
(
2000
);
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
...
...
@@ -513,7 +519,7 @@ export default function actsWifiManagerFunctionTest() {
expect
(
true
).
assertEqual
(
error
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[wifi_test]createGroup error passphrase result :
"
+
JSON
.
stringify
(
error
.
message
));
console
.
info
(
"
[wifi_test]create
P2p
Group error passphrase result :
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
...
...
@@ -539,8 +545,8 @@ export default function actsWifiManagerFunctionTest() {
let
p2pCancelResult
=
wifiMg
.
p2pCancelConnect
();
await
sleep
(
2000
);
console
.
info
(
"
[wifi_test]test p2pCancelConnect successful.
"
);
let
remove
GroupResult
=
wifiMg
.
remove
Group
();
console
.
info
(
"
[wifi_test]test removeGroup successful
"
);
let
remove
P2pGroupResult
=
wifiMg
.
removeP2p
Group
();
console
.
info
(
"
[wifi_test]test remove
P2p
Group successful
"
);
try
{
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
...
...
@@ -559,18 +565,26 @@ export default function actsWifiManagerFunctionTest() {
/**
* @tc.number SUB_Communication_WiFi_XTS_P2P_0011
* @tc.name test
Remove
Group
* @tc.name test
removeP2p
Group
* @tc.desc Test remove a nonexistent group.
* @tc.type Function
* @tc.level Level 3
*/
it
(
'
SUB_Communication_WiFi_XTS_P2P_0011
'
,
0
,
async
function
(
done
)
{
let
removeGroupResult
=
wifiMg
.
removeGroup
(
10000
);
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test] getCurrentP2pGroup promise result1 :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
deviceName
==
null
);
});
let
removeP2pGroupResult
=
wifiMg
.
removeP2pGroup
(
10000
);
try
{
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test] getCurrentP2pGroup promise result1 :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
deviceName
==
null
);
}).
catch
((
error
)
=>
{
console
.
error
(
'
[wifi_test] getCurrentP2pGroup promise failed :
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[wifi_test]getCurrentP2pGroup promise error:
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
})
...
...
@@ -662,7 +676,7 @@ export default function actsWifiManagerFunctionTest() {
it
(
'
SUB_Communication_WiFi_XTS_P2P_0001
'
,
0
,
async
function
(
done
){
console
.
log
(
"
[wifi_test]check the state of wifi:
"
+
wifiMg
.
isWifiActive
());
expect
(
wifiMg
.
isWifiActive
()).
assertTrue
();
let
startDiscover
=
wifiMg
.
startDiscoverDevices
();
let
startDiscover
=
wifiMg
.
startDiscover
P2p
Devices
();
await
sleep
(
2000
);
await
wifiMg
.
getP2pPeerDevices
()
.
then
((
data
)
=>
{
...
...
@@ -673,7 +687,7 @@ export default function actsWifiManagerFunctionTest() {
console
.
info
(
"
[wifi_test]getP2pPeerDevices promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
});
let
stopDiscover
=
wifiMg
.
stopDiscoverDevices
();
let
stopDiscover
=
wifiMg
.
stopDiscover
P2p
Devices
();
done
();
})
...
...
@@ -687,7 +701,7 @@ export default function actsWifiManagerFunctionTest() {
it
(
'
SUB_Communication_WiFi_XTS_P2P_0101
'
,
0
,
async
function
(
done
){
console
.
log
(
"
[wifi_test]check the state of wifi:
"
+
wifiMg
.
isWifiActive
());
expect
(
wifiMg
.
isWifiActive
()).
assertTrue
();
let
startDiscover
=
wifiMg
.
startDiscoverDevices
();
let
startDiscover
=
wifiMg
.
startDiscover
P2p
Devices
();
await
sleep
(
2000
);
function
getP2pPeerDevicesResult
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
communication/wifi_p2p/src/main/js/test/WifiP2PFunction.test.js
浏览文件 @
cb135430
...
...
@@ -130,6 +130,9 @@ export default function actsWifiFunctionTest() {
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test] getCurrentGroup promise result :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
networkId
==
-
999
);
}).
catch
((
error
)
=>
{
console
.
error
(
'
[wifi_test] getCurrentGroup promise failed :
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
});
let
removeGroupResult
=
wifi
.
removeGroup
();
await
sleep
(
2000
);
...
...
@@ -140,7 +143,7 @@ export default function actsWifiFunctionTest() {
console
.
info
(
"
[wifi_test] getCurrentGroup promise result1 :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
deviceName
==
null
);
}).
catch
((
error
)
=>
{
console
.
error
(
'
[wifi_test] getCurrentGroup promise failed :
'
+
JSON
.
stringify
(
error
));
console
.
error
(
'
[wifi_test] getCurrentGroup promise failed
1
:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
});
}
catch
(
error
){
...
...
@@ -265,6 +268,9 @@ export default function actsWifiFunctionTest() {
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test]getCurrentGroup promise result :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
passphrase
!=
wifiP2PConfig
.
passphrase
);
}).
catch
((
error
)
=>
{
console
.
error
(
'
[wifi_test] getCurrentGroup promise failed :
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
});
let
removeGroupResult
=
wifi
.
removeGroup
();
await
sleep
(
2000
);
...
...
@@ -275,7 +281,7 @@ export default function actsWifiFunctionTest() {
console
.
info
(
"
[wifi_test] getCurrentGroup promise result1 :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
deviceName
==
null
);
}).
catch
((
error
)
=>
{
console
.
error
(
'
[wifi_test] getCurrentGroup promise failed :
'
+
JSON
.
stringify
(
error
));
console
.
error
(
'
[wifi_test] getCurrentGroup promise failed
1
:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
});
}
catch
(
error
){
...
...
communication/wifi_standard/src/main/js/test/WifiCandidateNetWork.test.js
浏览文件 @
cb135430
...
...
@@ -125,4 +125,3 @@ export default function actsWifiCandidateNetWorkTest() {
})
}
communication/wifi_standard/src/main/js/test/WifiManagerCandidateNetWork.test.js
浏览文件 @
cb135430
...
...
@@ -78,7 +78,6 @@ export default function actsWifiManagerCandidateNetWorkTest() {
"
isHiddenSsid
"
:
false
,
"
securityType
"
:
wifiMg
.
WifiSecurityType
.
WIFI_SEC_TYPE_WEP
,
};
await
wifiMg
.
addCandidateConfig
(
wifiDeviceConfig1
)
.
then
(
netWorkId
=>
{
console
.
info
(
"
[wifi_test]add WEP CandidateConfig promise :
"
+
JSON
.
stringify
(
netWorkId
));
...
...
@@ -343,4 +342,3 @@ export default function actsWifiManagerCandidateNetWorkTest() {
})
}
communication/wifi_standard/src/main/js/test/WifiManagerStationEvent.test.js
浏览文件 @
cb135430
...
...
@@ -332,4 +332,3 @@ export default function actsWifiManagerEventTest() {
})
}
communication/wifi_standard/src/main/js/test/WifiManagerStationFunctions.test.js
浏览文件 @
cb135430
...
...
@@ -46,52 +46,6 @@ export default function actsWifiManagerFunctionsTest() {
afterEach
(
function
()
{
})
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0002
* @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_0002
'
,
0
,
async
function
(
done
)
{
let
scanResult
=
wifiMg
.
scan
();
await
sleep
(
3000
);
await
wifiMg
.
getScanResults
()
.
then
(
result
=>
{
let
clen
=
Object
.
keys
(
result
).
length
;
expect
(
true
).
assertEqual
(
clen
>=
0
);
console
.
info
(
"
[wifi_test]getScanInfos promise result:
"
+
JSON
.
stringify
(
result
));
});
function
getScan
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wifiMg
.
getScanResults
(
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
log
(
"
[wifi_test] wifi getScanInfos failed:
"
+
err
);
}
let
clen
=
Object
.
keys
(
result
).
length
;
if
(
!
(
clen
==
0
))
{
expect
(
clen
).
assertLarger
(
0
);
console
.
info
(
"
[wifi_test] getScanInfos 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
+
"
centerFrequency0:
"
+
result
[
j
].
centerFrequency0
+
"
centerFrequency1:
"
+
result
[
j
].
centerFrequency1
+
"
eid:
"
+
result
[
j
].
infoElems
.
eid
+
"
content:
"
+
result
[
j
].
infoElems
.
content
);
}
}
resolve
();
});
});
}
await
getScan
();
done
();
})
/**
* @tc.number SUB_Communication_WiFi_XTS_Sta_0021
* @tc.name testGetSignalLevel
...
...
@@ -230,7 +184,7 @@ export default function actsWifiManagerFunctionsTest() {
function
getLinked
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
wifiMg
.
getLinkedInfo
(
(
err
,
result
)
=>
{
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
log
(
"
[wifi_test]wifi getLinkedInfo failed
"
+
err
);
}
...
...
@@ -246,28 +200,28 @@ export default function actsWifiManagerFunctionsTest() {
"
suppState:
"
+
result
.
suppState
+
"
connState:
"
+
result
.
connState
+
"
macType:
"
+
result
.
macType
);
let
state
=
wifiMg
.
getLinkedInfo
().
ConnState
;
if
(
state
==
wifiMg
.
c
onnState
.
SCANNING
)
{
if
(
state
==
wifiMg
.
C
onnState
.
SCANNING
)
{
expect
(
true
).
assertEqual
(
state
==
0
);
}
if
(
state
==
wifiMg
.
c
onnState
.
CONNECTING
)
{
if
(
state
==
wifiMg
.
C
onnState
.
CONNECTING
)
{
expect
(
true
).
assertEqual
(
state
==
1
);
}
if
(
state
==
wifiMg
.
c
onnState
.
AUTHENTICATING
)
{
if
(
state
==
wifiMg
.
C
onnState
.
AUTHENTICATING
)
{
expect
(
true
).
assertEqual
(
state
==
2
);
}
if
(
state
==
wifiMg
.
c
onnState
.
OBTAINING_IPADDR
)
{
if
(
state
==
wifiMg
.
C
onnState
.
OBTAINING_IPADDR
)
{
expect
(
true
).
assertEqual
(
state
==
3
);
}
if
(
state
==
wifiMg
.
c
onnState
.
CONNECTED
)
{
if
(
state
==
wifiMg
.
C
onnState
.
CONNECTED
)
{
expect
(
true
).
assertEqual
(
state
==
4
);
}
if
(
state
==
wifiMg
.
c
onnState
.
DISCONNECTING
)
{
if
(
state
==
wifiMg
.
C
onnState
.
DISCONNECTING
)
{
expect
(
true
).
assertEqual
(
state
==
5
);
}
if
(
state
==
wifiMg
.
c
onnState
.
DISCONNECTED
)
{
if
(
state
==
wifiMg
.
C
onnState
.
DISCONNECTED
)
{
expect
(
true
).
assertEqual
(
state
==
6
);
}
if
(
state
==
wifiMg
.
c
onnState
.
UNKNOWN
)
{
if
(
state
==
wifiMg
.
C
onnState
.
UNKNOWN
)
{
expect
(
true
).
assertEqual
(
state
==
7
);
}
resolve
();
...
...
@@ -286,15 +240,29 @@ export default function actsWifiManagerFunctionsTest() {
* @tc.level Level 0
*/
it
(
'
SUB_Communication_WiFi_XTS_Sta_0034
'
,
0
,
async
function
(
done
)
{
let
getScanResultsResult
=
wifiMg
.
getScanResultsSync
();
console
.
info
(
"
[wifi_test]wifi getScanResultsSync result :
"
+
JSON
.
stringify
(
getScanResultsResult
));
let
scanInfolenth
=
Object
.
keys
(
getScanResultsResult
).
length
;
console
.
info
(
"
[wifi_test]wifi ScanInfosSync length result :
"
+
JSON
.
stringify
(
scanInfolenth
));
expect
(
true
).
assertEqual
(
scanInfolenth
>=
0
);
let
scanResult
=
wifiMg
.
scan
();
await
sleep
(
3000
);
let
getScanInfoListResult
=
wifiMg
.
getScanInfoList
();
console
.
info
(
"
[wifi_test]wifi getScanInfoList result :
"
+
JSON
.
stringify
(
getScanInfoListResult
));
let
clen
=
Object
.
keys
(
getScanInfoListResult
).
length
;
console
.
info
(
"
[wifi_test]wifi getScanInfoList length result :
"
+
JSON
.
stringify
(
clen
));
let
result
=
getScanInfoListResult
;
if
(
clen
>=
0
)
{
expect
(
true
).
assertEqual
(
clen
>=
0
);
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
+
"
centerFrequency0:
"
+
result
[
j
].
centerFrequency0
+
"
centerFrequency1:
"
+
result
[
j
].
centerFrequency1
+
"
eid:
"
+
result
[
j
].
infoElems
.
eid
+
"
content:
"
+
result
[
j
].
infoElems
.
content
);
}
}
done
();
})
console
.
log
(
"
*************[wifi_test] start wifi js unit test end*************
"
);
})
}
communication/wifi_standard/src/main/js/test/WifiStationEvent.test.js
浏览文件 @
cb135430
...
...
@@ -31,7 +31,7 @@ function resolveIP(ip) {
return
(
ip
>>
24
&
0xFF
)
+
"
.
"
+
(
ip
>>
16
&
0xFF
)
+
"
.
"
+
(
ip
>>
8
&
0xFF
)
+
"
.
"
+
(
ip
&
0xFF
);
}
let
p
owerModel
=
{
let
P
owerModel
=
{
SLEEPING
:
0
,
GENERAL
:
1
,
THROUGH_WALL
:
2
,
...
...
@@ -339,4 +339,3 @@ export default function actsWifiEventTest() {
})
}
communication/wifi_standard/src/main/js/test/WifiStationFunctions.test.js
浏览文件 @
cb135430
...
...
@@ -44,8 +44,6 @@ export default function actsWifiFunctionsTest() {
* @tc.level Level 0
*/
it
(
'
Communication_WiFi_XTS_Sta_0002
'
,
0
,
async
function
(
done
)
{
let
scan
=
wifi
.
scan
();
await
sleep
(
3000
);
await
wifi
.
getScanInfos
()
.
then
(
result
=>
{
let
clen
=
Object
.
keys
(
result
).
length
;
...
...
@@ -268,4 +266,3 @@ export default function actsWifiFunctionsTest() {
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录