Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
05a8a4be
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看板
未验证
提交
05a8a4be
编写于
4月 02, 2023
作者:
O
openharmony_ci
提交者:
Gitee
4月 02, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8331 【XTS】【communication】优化WIFI、lbs脚本
Merge pull request !8331 from 权力/myfeature
上级
c0f05e39
e1363319
变更
12
展开全部
显示空白变更内容
内联
并排
Showing
12 changed file
with
533 addition
and
329 deletion
+533
-329
communication/wifi_p2p/src/main/js/test/WifiManagerP2PEvent.test.js
...ion/wifi_p2p/src/main/js/test/WifiManagerP2PEvent.test.js
+3
-5
communication/wifi_p2p/src/main/js/test/WifiManagerP2PFunction.test.js
.../wifi_p2p/src/main/js/test/WifiManagerP2PFunction.test.js
+93
-43
communication/wifi_p2p/src/main/js/test/WifiP2PEvent.test.js
communication/wifi_p2p/src/main/js/test/WifiP2PEvent.test.js
+2
-6
communication/wifi_p2p/src/main/js/test/WifiP2PFunction.test.js
...ication/wifi_p2p/src/main/js/test/WifiP2PFunction.test.js
+30
-19
communication/wifi_standard/src/main/js/test/WifiCandidateNetWork.test.js
...fi_standard/src/main/js/test/WifiCandidateNetWork.test.js
+15
-10
communication/wifi_standard/src/main/js/test/WifiManagerCandidateNetWork.test.js
...dard/src/main/js/test/WifiManagerCandidateNetWork.test.js
+19
-9
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
+19
-9
communication/wifi_standard/src/main/js/test/WifiStationEvent.test.js
...n/wifi_standard/src/main/js/test/WifiStationEvent.test.js
+9
-6
location/geolocation_standard/src/main/js/test/GeocoderMTest.test.js
...olocation_standard/src/main/js/test/GeocoderMTest.test.js
+128
-93
location/geolocation_standard/src/main/js/test/GetCountryCodeM.test.js
...ocation_standard/src/main/js/test/GetCountryCodeM.test.js
+4
-3
location/geolocation_standard/src/main/js/test/LocationMTest.test.js
...olocation_standard/src/main/js/test/LocationMTest.test.js
+211
-125
未找到文件。
communication/wifi_p2p/src/main/js/test/WifiManagerP2PEvent.test.js
浏览文件 @
05a8a4be
...
...
@@ -14,7 +14,6 @@
*/
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
wifiMg
from
'
@ohos.wifiManager
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
bundle
from
'
@ohos.bundle
'
...
...
@@ -101,7 +100,7 @@ export default function actsWifiManagerEventTest() {
CONNECTED
:
1
,
};
let
wifiP2PConfig
=
{
deviceAddress
:
"
00:00:00:00:00:00
"
,
deviceAddress
:
"
22:9b:e6:48:1f:5c
"
,
netId
:
-
1
,
passphrase
:
"
12345678
"
,
groupName
:
"
DIRECT-AAAZZZ456
"
,
...
...
@@ -110,6 +109,7 @@ export default function actsWifiManagerEventTest() {
let
connectResult
=
wifiMg
.
p2pConnect
(
wifiP2PConfig
);
let
p2pCancelResult
=
wifiMg
.
p2pCancelConnect
();
await
sleep
(
2000
);
console
.
info
(
"
[wifi_test]test p2pCancelConnect successful.
"
);
await
wifiMg
.
getP2pLinkedInfo
()
.
then
(
data
=>
{
let
resultLength
=
Object
.
keys
(
data
).
length
;
...
...
@@ -174,14 +174,12 @@ export default function actsWifiManagerEventTest() {
}
wifiMg
.
on
(
p2pGroupState
,
p2pPersistentGroupChangeCallback
);
let
WifiP2PConfig
=
{
deviceAddress
:
"
00:00:00:00:00:00
"
,
deviceAddress
:
"
22:9b:e6:48:1f:5c
"
,
netId
:
-
2
,
passphrase
:
"
12345678
"
,
groupName
:
"
DIRECT-AAAZZZ123
"
,
goBand
:
wifiMg
.
GroupOwnerBand
.
GO_BAND_AUTO
,
};
let
createP2pGroupResult
=
wifiMg
.
createP2pGroup
(
WifiP2PConfig
);
await
(
2000
);
try
{
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
...
...
communication/wifi_p2p/src/main/js/test/WifiManagerP2PFunction.test.js
浏览文件 @
05a8a4be
...
...
@@ -84,11 +84,19 @@ export default function actsWifiManagerFunctionTest() {
expect
(
wifiMg
.
isWifiActive
()).
assertTrue
();
let
createP2pGroupResult
=
wifiMg
.
createP2pGroup
(
wifiP2PConfig
);
await
sleep
(
2000
);
try
{
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test]getCurrentP2pGroup promise result ->
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
groupName
==
wifiP2PConfig
.
groupName
);
console
.
info
(
"
[wifi_test] getCurrentP2pGroup promise result :
"
+
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
);
}
function
getCurrentP2pGroupResult
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
wifiMg
.
getCurrentP2pGroup
(
...
...
@@ -122,11 +130,11 @@ 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
){
console
.
info
(
"
[wifi_test]getCurrentP2pGroup promise error:
"
+
JSON
.
stringify
(
error
.
message
));
console
.
info
(
"
[wifi_test]getCurrentP2pGroup promise error
1
:
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
...
...
@@ -149,8 +157,14 @@ export default function actsWifiManagerFunctionTest() {
groupName
:
"
DIRECT-test_pass
"
,
goBand
:
wifiMg
.
GroupOwnerBand
.
GO_BAND_2GHZ
,
};
try
{
let
createP2pGroupResult
=
wifiMg
.
createP2pGroup
(
wifiP2PConfig
);
await
sleep
(
2000
);
}
catch
(
error
){
console
.
info
(
"
[wifi_test]createP2pGroup error:
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
try
{
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test] getCurrentP2pGroup promise result :
"
+
JSON
.
stringify
(
data
));
...
...
@@ -159,8 +173,17 @@ export default function actsWifiManagerFunctionTest() {
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
);
}
try
{
let
removeP2pGroupResult
=
wifiMg
.
removeP2pGroup
();
await
sleep
(
2000
);
}
catch
(
error
){
console
.
info
(
"
[wifi_test]removeP2pGroup error:
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
try
{
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
...
...
@@ -171,7 +194,7 @@ export default function actsWifiManagerFunctionTest() {
expect
(
true
).
assertEqual
(
error
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[wifi_test]getCurrentP2pGroup promise error:
"
+
JSON
.
stringify
(
error
.
message
));
console
.
info
(
"
[wifi_test]getCurrentP2pGroup promise error
1
:
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
...
...
@@ -278,18 +301,33 @@ export default function actsWifiManagerFunctionTest() {
groupName
:
"
DIRECT-test_pass3
"
,
goBand
:
wifiMg
.
GroupOwnerBand
.
GO_BAND_2GHZ
,
};
try
{
let
createP2pGroupResult
=
wifiMg
.
createP2pGroup
(
wifiP2PConfig
);
await
sleep
(
2000
);
}
catch
(
error
){
console
.
info
(
"
[wifi_test]createP2pGroup error:
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
try
{
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test]
getCurrentP2pGroup promise result :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
passphrase
!=
wifiP2PConfig
.
passphrase
);
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
);
});
}
catch
(
error
){
console
.
info
(
"
[wifi_test]getCurrentP2pGroup promise error:
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
try
{
let
removeP2pGroupResult
=
wifiMg
.
removeP2pGroup
();
await
sleep
(
2000
);
}
catch
(
error
){
console
.
info
(
"
[wifi_test]removeP2pGroup error:
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
try
{
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
...
...
@@ -371,7 +409,10 @@ export default function actsWifiManagerFunctionTest() {
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test] getCurrentP2pGroup promise result :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
5160
<
data
.
frequency
<
5865
);
expect
(
true
).
assertEqual
(
data
.
deviceName
==
null
);
}).
catch
((
error
)
=>
{
console
.
error
(
'
[wifi_test] getCurrentP2pGroup promise failed :
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
});
let
removeP2pGroupResult
=
await
wifiMg
.
removeP2pGroup
();
await
sleep
(
2000
);
...
...
@@ -380,11 +421,11 @@ 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
){
console
.
info
(
"
[wifi_test]createP2pGroup 5G goBand
result
:
"
+
JSON
.
stringify
(
error
.
message
));
console
.
info
(
"
[wifi_test]createP2pGroup 5G goBand
fail
:
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
...
...
@@ -450,13 +491,13 @@ export default function actsWifiManagerFunctionTest() {
groupName
:
""
,
goBand
:
wifiMg
.
GroupOwnerBand
.
GO_BAND_2GHZ
,
};
let
createP2pGroupResult
=
wifi
.
createP2pGroup
(
wifiP2PConfig
);
let
createP2pGroupResult
=
wifi
Mg
.
createP2pGroup
(
wifiP2PConfig
);
await
sleep
(
2000
);
await
wifi
.
getCurrentP2pGroup
()
await
wifi
Mg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test]getCurrentP2pGroup promise result :
"
+
JSON
.
stringify
(
data
));
});
let
removeP2pGroupResult
=
wifi
.
removeP2pGroup
();
let
removeP2pGroupResult
=
wifi
Mg
.
removeP2pGroup
();
await
sleep
(
2000
);
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
...
...
@@ -491,9 +532,9 @@ export default function actsWifiManagerFunctionTest() {
groupName
:
"
"
,
goBand
:
wifiMg
.
GroupOwnerBand
.
GO_BAND_2GHZ
,
};
let
createP2pGroupResult
=
wifi
.
createP2pGroup
(
wifiP2PConfig
);
let
createP2pGroupResult
=
wifi
Mg
.
createP2pGroup
(
wifiP2PConfig
);
await
sleep
(
2000
);
await
wifi
.
getCurrentP2pGroup
()
await
wifi
Mg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test]getCurrentP2pGroup promise result :
"
+
JSON
.
stringify
(
data
));
});
...
...
@@ -575,8 +616,12 @@ export default function actsWifiManagerFunctionTest() {
let
p2pCancelResult
=
wifiMg
.
p2pCancelConnect
();
await
sleep
(
2000
);
console
.
info
(
"
[wifi_test]test p2pCancelConnect successful.
"
);
try
{
let
removeP2pGroupResult
=
wifiMg
.
removeP2pGroup
();
console
.
info
(
"
[wifi_test]test removeP2pGroup successful
"
);
}
catch
(
error
){
console
.
info
(
"
[wifi_test]removeP2pGroup error:
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
try
{
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
...
...
@@ -601,7 +646,12 @@ export default function actsWifiManagerFunctionTest() {
* @tc.level Level 3
*/
it
(
'
SUB_Communication_WiFi_XTS_P2P_0011
'
,
0
,
async
function
(
done
)
{
try
{
let
removeP2pGroupResult
=
wifiMg
.
removeP2pGroup
(
10000
);
}
catch
(
error
){
console
.
info
(
"
[wifi_test]removeP2pGroup error:
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
try
{
await
wifiMg
.
getCurrentP2pGroup
()
.
then
(
data
=>
{
...
...
communication/wifi_p2p/src/main/js/test/WifiP2PEvent.test.js
浏览文件 @
05a8a4be
...
...
@@ -97,7 +97,7 @@ export default function actsWifiEventTest() {
}
wifi
.
on
(
p2pConnectionState
,
p2pConnectionChangeCallback
);
let
wifiP2PConfig
=
{
deviceAddress
:
"
00:00:00:00:00:00
"
,
deviceAddress
:
"
22:9b:e6:48:1f:5c
"
,
netId
:
-
1
,
passphrase
:
"
12345678
"
,
groupName
:
"
DIRECT-AAAZZZ456
"
,
...
...
@@ -174,16 +174,12 @@ export default function actsWifiEventTest() {
}
wifi
.
on
(
p2pGroupState
,
p2pPersistentGroupChangeCallback
);
let
WifiP2PConfig
=
{
deviceAddress
:
"
00:00:00:00:00:00
"
,
deviceAddress
:
"
22:9b:e6:48:1f:5c
"
,
netId
:
-
2
,
passphrase
:
"
12345678
"
,
groupName
:
"
DIRECT-AAAZZZ123
"
,
goBand
:
wifi
.
GroupOwnerBand
.
GO_BAND_AUTO
,
};
let
createGroupResult
=
wifi
.
createGroup
(
WifiP2PConfig
);
await
(
2000
);
console
.
info
(
"
[wifi_test] test createGroup result.
"
+
createGroupResult
)
expect
(
createGroupResult
).
assertTrue
();
try
{
await
wifi
.
getCurrentGroup
()
.
then
(
data
=>
{
...
...
communication/wifi_p2p/src/main/js/test/WifiP2PFunction.test.js
浏览文件 @
05a8a4be
...
...
@@ -81,16 +81,24 @@ export default function actsWifiFunctionTest() {
goBand
:
wifi
.
GroupOwnerBand
.
GO_BAND_2GHZ
,
};
console
.
log
(
"
[wifi_test]check the state of wifi:
"
+
wifi
.
isWifiActive
());
expect
(
wifi
.
isWifiActive
()).
assertTrue
();
expect
(
wifi
.
isWifiActive
()).
assertTrue
();
let
createGroupResult
=
wifi
.
createGroup
(
wifiP2PConfig
);
console
.
log
(
"
[wifi_test]createGroup result:
"
+
JSON
.
stringify
(
createGroupResult
));
await
sleep
(
2000
);
expect
(
createGroupResult
).
assertTrue
();
try
{
await
wifi
.
getCurrentGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test]getCurrentGroup promise result ->
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[wifi_test] getCurrentGroup promise result :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
.
groupName
==
wifiP2PConfig
.
groupName
);
}).
catch
((
error
)
=>
{
console
.
error
(
'
[wifi_test] getCurrentGroup promise failed :
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[wifi_test]getCurrentGroup promise error:
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
function
getCurrentGroupResult
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
wifi
.
getCurrentGroup
(
...
...
@@ -125,11 +133,11 @@ 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
));
expect
(
true
).
assertEqual
(
error
!=
null
);
console
.
error
(
'
[wifi_test] getCurrentGroup promise failed
1
:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[wifi_test]getCurrentGroup promise error:
"
+
JSON
.
stringify
(
error
.
message
));
console
.
info
(
"
[wifi_test]getCurrentGroup promise error
1
:
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
...
...
@@ -155,7 +163,7 @@ export default function actsWifiFunctionTest() {
let
createGroupResult
=
wifi
.
createGroup
(
wifiP2PConfig
);
console
.
info
(
"
[wifi_test]test createGroup end.
"
+
JSON
.
stringify
(
createGroupResult
));
await
sleep
(
2000
);
expect
(
createGroupResult
).
assert
Tru
e
();
expect
(
createGroupResult
).
assert
Fals
e
();
await
wifi
.
getCurrentGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test] getCurrentGroup promise result :
"
+
JSON
.
stringify
(
data
));
...
...
@@ -166,7 +174,7 @@ export default function actsWifiFunctionTest() {
});
let
removeGroupResult
=
wifi
.
removeGroup
();
await
sleep
(
2000
);
expect
(
removeGroupResult
).
assert
Tru
e
();
expect
(
removeGroupResult
).
assert
Fals
e
();
try
{
await
wifi
.
getCurrentGroup
()
.
then
(
data
=>
{
...
...
@@ -293,7 +301,7 @@ export default function actsWifiFunctionTest() {
let
createGroupResult
=
wifi
.
createGroup
(
wifiP2PConfig
);
console
.
info
(
"
[wifi_test]test createGroup end.
"
+
JSON
.
stringify
(
createGroupResult
));
await
sleep
(
2000
);
expect
(
createGroupResult
).
assert
Tru
e
();
expect
(
createGroupResult
).
assert
Fals
e
();
await
wifi
.
getCurrentGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test]getCurrentGroup promise result :
"
+
JSON
.
stringify
(
data
));
...
...
@@ -304,7 +312,7 @@ export default function actsWifiFunctionTest() {
});
let
removeGroupResult
=
wifi
.
removeGroup
();
await
sleep
(
2000
);
expect
(
removeGroupResult
).
assert
Tru
e
();
expect
(
removeGroupResult
).
assert
Fals
e
();
try
{
await
wifi
.
getCurrentGroup
()
.
then
(
data
=>
{
...
...
@@ -391,7 +399,10 @@ export default function actsWifiFunctionTest() {
await
wifi
.
getCurrentGroup
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test] getCurrentGroup promise result :
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
5160
<
data
.
frequency
<
5865
);
expect
(
true
).
assertEqual
(
data
.
deviceName
==
null
);
}).
catch
((
error
)
=>
{
console
.
error
(
'
[wifi_test] getCurrentGroup promise failed :
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
});
let
removeGroupResult
=
await
wifi
.
removeGroup
();
await
sleep
(
2000
);
...
...
@@ -401,11 +412,11 @@ 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
));
expect
(
true
).
assertEqual
(
error
!=
null
);
console
.
error
(
'
[wifi_test] getCurrentGroup promise failed
1
:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
});
}
catch
(
error
){
console
.
info
(
"
[wifi_test]createGroup 5G goBand
result
:
"
+
JSON
.
stringify
(
error
.
message
));
console
.
info
(
"
[wifi_test]createGroup 5G goBand
fail
:
"
+
JSON
.
stringify
(
error
.
message
));
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
...
...
@@ -479,7 +490,7 @@ export default function actsWifiFunctionTest() {
expect
(
p2pCancelResult
).
assertTrue
();
let
removeGroupResult
=
wifi
.
removeGroup
();
console
.
info
(
"
[wifi_test]test start removeGroup:
"
+
removeGroupResult
);
expect
(
removeGroupResult
).
assert
Tru
e
();
expect
(
removeGroupResult
).
assert
Fals
e
();
try
{
await
wifi
.
getCurrentGroup
()
.
then
(
data
=>
{
...
...
@@ -506,7 +517,7 @@ export default function actsWifiFunctionTest() {
it
(
'
Communication_WiFi_XTS_P2P_0011
'
,
0
,
async
function
(
done
)
{
let
removeGroupResult
=
wifi
.
removeGroup
(
10000
);
console
.
info
(
"
[wifi_test]removeGroup(10000) result :
"
+
JSON
.
stringify
(
removeGroupResult
));
expect
(
removeGroupResult
).
assert
Tru
e
();
expect
(
removeGroupResult
).
assert
Fals
e
();
try
{
await
wifi
.
getCurrentGroup
()
.
then
(
data
=>
{
...
...
communication/wifi_standard/src/main/js/test/WifiCandidateNetWork.test.js
浏览文件 @
05a8a4be
...
...
@@ -53,14 +53,6 @@ function resolveIP(ip) {
return
(
ip
>>
24
&
0xFF
)
+
"
.
"
+
(
ip
>>
16
&
0xFF
)
+
"
.
"
+
(
ip
>>
8
&
0xFF
)
+
"
.
"
+
(
ip
&
0xFF
);
}
let
wifiSecurityType
=
{
WIFI_SEC_TYPE_INVALID
:
0
,
WIFI_SEC_TYPE_OPEN
:
1
,
WIFI_SEC_TYPE_WEP
:
2
,
WIFI_SEC_TYPE_PSK
:
3
,
WIFI_SEC_TYPE_SAE
:
4
,
}
export
default
function
actsWifiCandidateNetWorkTest
()
{
describe
(
'
actsWifiCandidateNetWorkTest
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
...
...
@@ -88,7 +80,7 @@ export default function actsWifiCandidateNetWorkTest() {
"
bssid
"
:
"
22:9b:e6:48:1f:5c
"
,
"
preSharedKey
"
:
"
12345678
"
,
"
isHiddenSsid
"
:
false
,
"
securityType
"
:
wifiSecurityType
.
WIFI_SEC_TYPE_PSK
,
"
securityType
"
:
wifi
.
Wifi
SecurityType
.
WIFI_SEC_TYPE_PSK
,
};
await
wifi
.
addUntrustedConfig
(
wifiDeviceConfig
)
.
then
(
ret
=>
{
...
...
@@ -104,6 +96,19 @@ export default function actsWifiCandidateNetWorkTest() {
}).
catch
((
error
)
=>
{
console
.
error
(
'
[wifi_test]removeUntrustedConfig promise failed ->
'
+
JSON
.
stringify
(
error
));
});
let
WIFI_SEC_TYPE_INVALID
=
wifi
.
WifiSecurityType
.
WIFI_SEC_TYPE_INVALID
;
console
.
info
(
"
[wifi_test]WIFI_SEC_TYPE_INVALID :
"
+
JSON
.
stringify
(
WIFI_SEC_TYPE_INVALID
));
expect
(
true
).
assertEqual
(
WIFI_SEC_TYPE_INVALID
==
0
);
let
WIFI_SEC_TYPE_OPEN
=
wifi
.
WifiSecurityType
.
WIFI_SEC_TYPE_OPEN
;
console
.
info
(
"
[wifi_test]WIFI_SEC_TYPE_OPEN :
"
+
JSON
.
stringify
(
WIFI_SEC_TYPE_OPEN
));
expect
(
true
).
assertEqual
(
WIFI_SEC_TYPE_OPEN
==
1
);
let
WIFI_SEC_TYPE_WEP
=
wifi
.
WifiSecurityType
.
WIFI_SEC_TYPE_WEP
;
console
.
info
(
"
[wifi_test]WIFI_SEC_TYPE_WEP :
"
+
JSON
.
stringify
(
WIFI_SEC_TYPE_WEP
));
expect
(
true
).
assertEqual
(
WIFI_SEC_TYPE_WEP
==
2
);
let
WIFI_SEC_TYPE_SAE
=
wifi
.
WifiSecurityType
.
WIFI_SEC_TYPE_SAE
;
console
.
info
(
"
[wifi_test]WIFI_SEC_TYPE_SAE :
"
+
JSON
.
stringify
(
WIFI_SEC_TYPE_SAE
));
expect
(
true
).
assertEqual
(
WIFI_SEC_TYPE_SAE
==
4
);
done
();
})
...
...
@@ -120,7 +125,7 @@ export default function actsWifiCandidateNetWorkTest() {
"
bssid
"
:
"
22:9b:e6:48:1f:5c
"
,
"
preSharedKey
"
:
"
12345678
"
,
"
isHiddenSsid
"
:
false
,
"
securityType
"
:
wifiSecurityType
.
WIFI_SEC_TYPE_PSK
,
"
securityType
"
:
wifi
.
Wifi
SecurityType
.
WIFI_SEC_TYPE_PSK
,
}
function
addCandidate
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
communication/wifi_standard/src/main/js/test/WifiManagerCandidateNetWork.test.js
浏览文件 @
05a8a4be
...
...
@@ -53,15 +53,6 @@ function resolveIP(ip) {
return
(
ip
>>
24
&
0xFF
)
+
"
.
"
+
(
ip
>>
16
&
0xFF
)
+
"
.
"
+
(
ip
>>
8
&
0xFF
)
+
"
.
"
+
(
ip
&
0xFF
);
}
let
wifiSecurityType
=
{
WIFI_SEC_TYPE_INVALID
:
0
,
WIFI_SEC_TYPE_EAP
:
5
,
WIFI_SEC_TYPE_EAP_SUITE_B
:
6
,
WIFI_SEC_TYPE_OWE
:
7
,
WIFI_SEC_TYPE_WAPI_CERT
:
8
,
WIFI_SEC_TYPE_WAPI_PSK
:
9
,
}
export
default
function
actsWifiManagerCandidateNetWorkTest
()
{
describe
(
'
actsWifiManagerCandidateNetWorkTest
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
...
...
@@ -117,6 +108,25 @@ export default function actsWifiManagerCandidateNetWorkTest() {
expect
(
true
).
assertEqual
(
(
JSON
.
stringify
(
error
))
!=
null
);
});
console
.
info
(
"
[wifi_test]wifi get WEP CandidateConfigs result :
"
+
JSON
.
stringify
(
getconfig
));
let
WIFI_SEC_TYPE_INVALID
=
wifiMg
.
WifiSecurityType
.
WIFI_SEC_TYPE_INVALID
;
console
.
info
(
"
[wifi_test]WIFI_SEC_TYPE_INVALID :
"
+
JSON
.
stringify
(
WIFI_SEC_TYPE_INVALID
));
expect
(
true
).
assertEqual
(
WIFI_SEC_TYPE_INVALID
==
0
);
let
WIFI_SEC_TYPE_EAP
=
wifiMg
.
WifiSecurityType
.
WIFI_SEC_TYPE_EAP
;
console
.
info
(
"
[wifi_test]WIFI_SEC_TYPE_EAP :
"
+
JSON
.
stringify
(
WIFI_SEC_TYPE_EAP
));
expect
(
true
).
assertEqual
(
WIFI_SEC_TYPE_EAP
==
5
);
let
WIFI_SEC_TYPE_EAP_SUITE_B
=
wifiMg
.
WifiSecurityType
.
WIFI_SEC_TYPE_EAP_SUITE_B
;
console
.
info
(
"
[wifi_test]WIFI_SEC_TYPE_EAP_SUITE_B :
"
+
JSON
.
stringify
(
WIFI_SEC_TYPE_EAP_SUITE_B
));
expect
(
true
).
assertEqual
(
WIFI_SEC_TYPE_EAP_SUITE_B
==
6
);
let
WIFI_SEC_TYPE_OWE
=
wifiMg
.
WifiSecurityType
.
WIFI_SEC_TYPE_OWE
;
console
.
info
(
"
[wifi_test]WIFI_SEC_TYPE_OWE :
"
+
JSON
.
stringify
(
WIFI_SEC_TYPE_OWE
));
expect
(
true
).
assertEqual
(
WIFI_SEC_TYPE_OWE
==
7
);
let
WIFI_SEC_TYPE_WAPI_CERT
=
wifiMg
.
WifiSecurityType
.
WIFI_SEC_TYPE_WAPI_CERT
;
console
.
info
(
"
[wifi_test]WIFI_SEC_TYPE_WAPI_CERT :
"
+
JSON
.
stringify
(
WIFI_SEC_TYPE_WAPI_CERT
));
expect
(
true
).
assertEqual
(
WIFI_SEC_TYPE_WAPI_CERT
==
8
);
let
WIFI_SEC_TYPE_WAPI_PSK
=
wifiMg
.
WifiSecurityType
.
WIFI_SEC_TYPE_WAPI_PSK
;
console
.
info
(
"
[wifi_test]WIFI_SEC_TYPE_WAPI_CERT :
"
+
JSON
.
stringify
(
WIFI_SEC_TYPE_WAPI_PSK
));
expect
(
true
).
assertEqual
(
WIFI_SEC_TYPE_WAPI_PSK
==
9
);
done
();
})
...
...
communication/wifi_standard/src/main/js/test/WifiManagerStationEvent.test.js
浏览文件 @
05a8a4be
...
...
@@ -16,7 +16,6 @@
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
wifiMg
from
'
@ohos.wifiManager
'
import
wifiManagerExt
from
'
@ohos.wifiManagerExt
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
bundle
from
'
@ohos.bundle
'
...
...
communication/wifi_standard/src/main/js/test/WifiManagerStationFunctions.test.js
浏览文件 @
05a8a4be
...
...
@@ -53,15 +53,6 @@ function resolveIP(ip) {
return
(
ip
>>
24
&
0xFF
)
+
"
.
"
+
(
ip
>>
16
&
0xFF
)
+
"
.
"
+
(
ip
>>
8
&
0xFF
)
+
"
.
"
+
(
ip
&
0xFF
);
}
let
wifiChannelWidth
=
{
WIDTH_20MHZ
:
0
,
WIDTH_40MHZ
:
1
,
WIDTH_80MHZ
:
2
,
WIDTH_160MHZ
:
3
,
WIDTH_80MHZ_PLUS
:
4
,
WIDTH_INVALID
:
null
,
}
export
default
function
actsWifiManagerFunctionsTest
()
{
describe
(
'
actsWifiManagerFunctionsTest
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
...
...
@@ -139,6 +130,25 @@ export default function actsWifiManagerFunctionsTest() {
let
countrylenth
=
getCountryCodeResult
.
length
;
console
.
info
(
"
[wifi_test]getCountryCode.length :
"
+
JSON
.
stringify
(
countrylenth
));
expect
(
true
).
assertEqual
(
countrylenth
==
2
);
let
WIDTH_20MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_20MHZ
;
console
.
info
(
"
[wifi_test]WIDTH_20MHZ :
"
+
JSON
.
stringify
(
WIDTH_20MHZ
));
expect
(
true
).
assertEqual
(
WIDTH_20MHZ
==
0
);
let
WIDTH_40MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_40MHZ
;
console
.
info
(
"
[wifi_test]WIDTH_40MHZ :
"
+
JSON
.
stringify
(
WIDTH_40MHZ
));
expect
(
true
).
assertEqual
(
WIDTH_40MHZ
==
1
);
let
WIDTH_80MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_80MHZ
;
console
.
info
(
"
[wifi_test]WIDTH_80MHZ :
"
+
JSON
.
stringify
(
WIDTH_80MHZ
));
expect
(
true
).
assertEqual
(
WIDTH_80MHZ
==
2
);
let
WIDTH_160MHZ
=
wifiMg
.
WifiChannelWidth
.
WIDTH_160MHZ
;
console
.
info
(
"
[wifi_test]WIDTH_160MHZ :
"
+
JSON
.
stringify
(
WIDTH_160MHZ
));
expect
(
true
).
assertEqual
(
WIDTH_160MHZ
==
3
);
let
WIDTH_80MHZ_PLUS
=
wifiMg
.
WifiChannelWidth
.
WIDTH_80MHZ_PLUS
;
console
.
info
(
"
[wifi_test]WIDTH_80MHZ_PLUS :
"
+
JSON
.
stringify
(
WIDTH_80MHZ_PLUS
));
expect
(
true
).
assertEqual
(
WIDTH_80MHZ_PLUS
==
4
);
let
WIDTH_INVALID
=
wifiMg
.
WifiChannelWidth
.
WIDTH_INVALID
;
console
.
info
(
"
[wifi_test]WIDTH_INVALID :
"
+
JSON
.
stringify
(
WIDTH_INVALID
));
expect
(
true
).
assertEqual
(
WIDTH_INVALID
==
5
);
})
/**
...
...
communication/wifi_standard/src/main/js/test/WifiStationEvent.test.js
浏览文件 @
05a8a4be
...
...
@@ -16,7 +16,6 @@
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
wifi
from
'
@ohos.wifi
'
import
wifiext
from
'
@ohos.wifiext
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
bundle
from
'
@ohos.bundle
'
...
...
@@ -54,11 +53,6 @@ function resolveIP(ip) {
return
(
ip
>>
24
&
0xFF
)
+
"
.
"
+
(
ip
>>
16
&
0xFF
)
+
"
.
"
+
(
ip
>>
8
&
0xFF
)
+
"
.
"
+
(
ip
&
0xFF
);
}
let
PowerModel
=
{
SLEEPING
:
0
,
GENERAL
:
1
,
THROUGH_WALL
:
2
,
}
export
default
function
actsWifiEventTest
()
{
describe
(
'
actsWifiEventTest
'
,
function
()
{
...
...
@@ -362,6 +356,15 @@ export default function actsWifiEventTest() {
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0007 canIUse isAccessToken error:
"
+
e
);
}
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0007 end
'
);
let
SLEEPING
=
wifiext
.
PowerModel
.
SLEEPING
;
console
.
info
(
"
[wifi_test]SLEEPING :
"
+
JSON
.
stringify
(
SLEEPING
));
expect
(
true
).
assertEqual
(
SLEEPING
==
0
);
let
GENERAL
=
wifiext
.
PowerModel
.
GENERAL
;
console
.
info
(
"
[wifi_test]GENERAL :
"
+
JSON
.
stringify
(
GENERAL
));
expect
(
true
).
assertEqual
(
GENERAL
==
1
);
let
THROUGH
=
wifiext
.
PowerModel
.
THROUGH_WALL
;
console
.
info
(
"
[wifi_test]THROUGH :
"
+
JSON
.
stringify
(
THROUGH
));
expect
(
true
).
assertEqual
(
THROUGH
==
2
);
done
();
})
console
.
log
(
"
*************[wifi_test] start wifi js unit test end*************
"
);
...
...
location/geolocation_standard/src/main/js/test/GeocoderMTest.test.js
浏览文件 @
05a8a4be
此差异已折叠。
点击以展开。
location/geolocation_standard/src/main/js/test/GetCountryCodeM.test.js
浏览文件 @
05a8a4be
...
...
@@ -30,7 +30,7 @@ async function changedLocationMode(){
console
.
info
(
'
[lbs_js] getLocationSwitchState result:
'
+
JSON
.
stringify
(
result1
));
if
(
!
result1
){
await
geolocation
.
requestEnableLocation
().
then
(
async
(
result
)
=>
{
await
sleep
(
3
000
);
await
sleep
(
1
000
);
console
.
info
(
'
[lbs_js] test requestEnableLocation promise result:
'
+
JSON
.
stringify
(
result
));
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] promise then error.
"
+
JSON
.
stringify
(
error
));
...
...
@@ -130,6 +130,7 @@ export default function geolocationTest_6() {
geolocationm
.
getCountryCode
((
err
,
data
)
=>
{
if
(
err
)
{
return
console
.
info
(
"
[lbs_js] getCountryCode callback err:
"
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
}
else
{
console
.
info
(
"
[lbs_js] getCountryCode callback success
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
!=
null
);
...
...
@@ -158,7 +159,7 @@ export default function geolocationTest_6() {
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] countryCodeChangeOn try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
expect
(
).
assertFail
(
);
}
try
{
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
...
...
@@ -178,7 +179,7 @@ export default function geolocationTest_6() {
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] countryCodeChangeOn try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
expect
(
).
assertFail
(
);
}
done
();
})
...
...
location/geolocation_standard/src/main/js/test/LocationMTest.test.js
浏览文件 @
05a8a4be
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录