Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
d71f8cfb
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看板
提交
d71f8cfb
编写于
10月 30, 2022
作者:
Q
quanli
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
quanli1@huawei.com
Signed-off-by:
N
quanli
<
quanli1@huawei.com
>
上级
f8db5871
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
250 addition
and
29 deletion
+250
-29
communication/wifi_standard/src/main/js/test/WifiCandidateNetWork.test.js
...fi_standard/src/main/js/test/WifiCandidateNetWork.test.js
+6
-0
communication/wifi_standard/src/main/js/test/WifiStationEvent.test.js
...n/wifi_standard/src/main/js/test/WifiStationEvent.test.js
+244
-29
未找到文件。
communication/wifi_standard/src/main/js/test/WifiCandidateNetWork.test.js
浏览文件 @
d71f8cfb
...
...
@@ -35,6 +35,11 @@ let wifiSecurityType = {
WIFI_SEC_TYPE_WEP
:
2
,
WIFI_SEC_TYPE_PSK
:
3
,
WIFI_SEC_TYPE_SAE
:
4
,
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
,
}
let
connState
=
{
...
...
@@ -444,3 +449,4 @@ export default function actsWifiCandidateNetWorkTest() {
})
}
communication/wifi_standard/src/main/js/test/WifiStationEvent.test.js
浏览文件 @
d71f8cfb
...
...
@@ -19,6 +19,8 @@ import wifi from '@ohos.wifi'
import
wifiext
from
'
@ohos.wifiext
'
import
wifiManagerExt
from
'
@ohos.wifiManagerExt
'
function
sleep
(
delay
)
{
return
new
Promise
(
resovle
=>
setTimeout
(
resovle
,
delay
))
}
...
...
@@ -178,11 +180,11 @@ export default function actsWifiEventTest() {
* @tc.type Function
*/
it
(
'
SUB_Communication_WiFi_SysCaps_Test_0001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testSysCaps
01 start
'
);
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_00
01 start
'
);
let
ret
=
false
;
try
{
var
isAccessToken
=
canIUse
(
"
SystemCapability.Communication.WiFi.AP.Extension
"
);
console
.
info
(
"
testSysCaps
01 test.syscap.param.001 :
"
+
isAccessToken
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_00
01 test.syscap.param.001 :
"
+
isAccessToken
);
if
(
isAccessToken
)
{
ret
=
true
;
}
...
...
@@ -191,9 +193,9 @@ export default function actsWifiEventTest() {
done
();
}
catch
(
e
)
{
expect
(
ret
).
assertFalse
();
console
.
info
(
"
testSysCaps
01 canIUse isAccessToken error:
"
+
e
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_00
01 canIUse isAccessToken error:
"
+
e
);
}
console
.
info
(
'
testSysCaps
01 end
'
);
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_00
01 end
'
);
done
();
})
...
...
@@ -204,11 +206,11 @@ export default function actsWifiEventTest() {
* @tc.type Function
*/
it
(
'
SUB_Communication_WiFi_SysCaps_Test_0002
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testSysCaps
02 start
'
);
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_00
02 start
'
);
let
ret
=
false
;
try
{
var
isAccessToken
=
canIUse
(
"
SystemCapability.Communication.WiFi.AP.Extension
"
);
console
.
info
(
"
testSysCaps01
test.syscap.param.001 :
"
+
isAccessToken
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0002
test.syscap.param.001 :
"
+
isAccessToken
);
if
(
isAccessToken
)
{
ret
=
true
;
}
...
...
@@ -217,9 +219,9 @@ export default function actsWifiEventTest() {
done
();
}
catch
(
e
)
{
expect
(
ret
).
assertFalse
();
console
.
info
(
"
testSysCaps
02 canIUse isAccessToken error:
"
+
e
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_00
02 canIUse isAccessToken error:
"
+
e
);
}
console
.
info
(
'
testSysCaps
02 end
'
);
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_00
02 end
'
);
done
();
})
...
...
@@ -230,11 +232,11 @@ export default function actsWifiEventTest() {
* @tc.type Function
*/
it
(
'
SUB_Communication_WiFi_SysCaps_Test_0003
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testSysCaps
03 start
'
);
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_00
03 start
'
);
let
ret
=
false
;
try
{
var
isAccessToken
=
canIUse
(
"
SystemCapability.Communication.WiFi.AP.Extension
"
);
console
.
info
(
"
testSysCaps01
test.syscap.param.001 :
"
+
isAccessToken
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0003
test.syscap.param.001 :
"
+
isAccessToken
);
if
(
isAccessToken
)
{
ret
=
true
;
}
...
...
@@ -246,9 +248,9 @@ export default function actsWifiEventTest() {
done
();
}
catch
(
e
)
{
expect
(
ret
).
assertFalse
();
console
.
info
(
"
testSysCaps
03 canIUse isAccessToken error:
"
+
e
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_00
03 canIUse isAccessToken error:
"
+
e
);
}
console
.
info
(
'
testSysCaps
03 end
'
);
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_00
03 end
'
);
done
();
})
...
...
@@ -259,11 +261,11 @@ export default function actsWifiEventTest() {
* @tc.type Function
*/
it
(
'
SUB_Communication_WiFi_SysCaps_Test_0004
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testSysCaps
04 start
'
);
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_00
04 start
'
);
let
ret
=
false
;
try
{
var
isAccessToken
=
canIUse
(
"
SystemCapability.Communication.WiFi.AP.Extension
"
);
console
.
info
(
"
testSysCaps
04 test.syscap.param.001 :
"
+
isAccessToken
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_00
04 test.syscap.param.001 :
"
+
isAccessToken
);
if
(
isAccessToken
)
{
ret
=
true
;
}
...
...
@@ -285,9 +287,9 @@ export default function actsWifiEventTest() {
done
();
}
catch
(
e
)
{
expect
(
ret
).
assertFalse
();
console
.
info
(
"
testSysCaps
04 canIUse isAccessToken error:
"
+
e
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_00
04 canIUse isAccessToken error:
"
+
e
);
}
console
.
info
(
'
testSysCaps
04 end
'
);
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_00
04 end
'
);
done
();
})
...
...
@@ -298,11 +300,11 @@ export default function actsWifiEventTest() {
* @tc.type Function
*/
it
(
'
SUB_Communication_WiFi_SysCaps_Test_0005
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testSysCaps
05 start
'
);
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_00
05 start
'
);
let
ret
=
false
;
try
{
var
isAccessToken
=
canIUse
(
"
SystemCapability.Communication.WiFi.AP.Extension
"
);
console
.
info
(
"
testSysCaps01
test.syscap.param.001 :
"
+
isAccessToken
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0005
test.syscap.param.001 :
"
+
isAccessToken
);
if
(
isAccessToken
)
{
ret
=
true
;
}
...
...
@@ -314,9 +316,9 @@ export default function actsWifiEventTest() {
done
();
}
catch
(
e
)
{
expect
(
ret
).
assertFalse
();
console
.
info
(
"
testSysCaps
05 canIUse isAccessToken error:
"
+
e
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_00
05 canIUse isAccessToken error:
"
+
e
);
}
console
.
info
(
'
testSysCaps
05 end
'
);
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_00
05 end
'
);
done
();
})
...
...
@@ -327,11 +329,11 @@ export default function actsWifiEventTest() {
* @tc.type Function
*/
it
(
'
SUB_Communication_WiFi_SysCaps_Test_0006
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testSysCaps04
start
'
);
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0006
start
'
);
let
ret
=
false
;
try
{
var
isAccessToken
=
canIUse
(
"
SystemCapability.Communication.WiFi.AP.Extension
"
);
console
.
info
(
"
testSysCaps04
test.syscap.param.001 :
"
+
isAccessToken
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0006
test.syscap.param.001 :
"
+
isAccessToken
);
if
(
isAccessToken
)
{
ret
=
true
;
}
...
...
@@ -353,9 +355,9 @@ export default function actsWifiEventTest() {
done
();
}
catch
(
e
)
{
expect
(
ret
).
assertFalse
();
console
.
info
(
"
testSysCaps
06 canIUse isAccessToken error:
"
+
e
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_00
06 canIUse isAccessToken error:
"
+
e
);
}
console
.
info
(
'
testSysCaps
06 end
'
);
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_00
06 end
'
);
done
();
})
...
...
@@ -366,11 +368,11 @@ export default function actsWifiEventTest() {
* @tc.type Function
*/
it
(
'
SUB_Communication_WiFi_SysCaps_Test_0007
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testSysCaps01
start
'
);
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0007
start
'
);
let
ret
=
false
;
try
{
var
isAccessToken
=
canIUse
(
"
SystemCapability.Communication.WiFi.AP.Extension
"
);
console
.
info
(
"
testSysCaps01
test.syscap.param.001 :
"
+
isAccessToken
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0007
test.syscap.param.001 :
"
+
isAccessToken
);
if
(
isAccessToken
)
{
ret
=
true
;
}
...
...
@@ -379,9 +381,223 @@ export default function actsWifiEventTest() {
done
();
}
catch
(
e
)
{
expect
(
ret
).
assertFalse
();
console
.
info
(
"
testSysCaps07 canIUse isAccessToken error:
"
+
e
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0007 canIUse isAccessToken error:
"
+
e
);
}
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0007 end
'
);
done
();
})
/**
* @tc.number SUB_Communication_WiFi_SysCaps_Test_0008
* @tc.name testenableHotspot
* @tc.desc Test enableHotspot api.
* @tc.type Function
*/
it
(
'
SUB_Communication_WiFi_SysCaps_Test_0008
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0008 start
'
);
let
ret
=
false
;
try
{
var
isAccessToken
=
canIUse
(
"
SystemCapability.Communication.WiFi.AP.Extension
"
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0008 test.syscap.param.001 :
"
+
isAccessToken
);
if
(
isAccessToken
)
{
ret
=
true
;
}
console
.
info
(
"
[wifi_test] enableHotspot:
"
+
wifiManagerExt
.
enableHotspot
())
expect
(
isAccessToken
).
assertFalse
();
done
();
}
catch
(
e
)
{
expect
(
ret
).
assertFalse
();
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0008 canIUse isAccessToken error:
"
+
e
);
}
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0008 end
'
);
done
();
})
/**
* @tc.number SUB_Communication_WiFi_SysCaps_Test_0009
* @tc.name testdisableHotspot
* @tc.desc Test disableHotspot api.
* @tc.type Function
*/
it
(
'
SUB_Communication_WiFi_SysCaps_Test_0009
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0009 start
'
);
let
ret
=
false
;
try
{
var
isAccessToken
=
canIUse
(
"
SystemCapability.Communication.WiFi.AP.Extension
"
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0009 test.syscap.param.001 :
"
+
isAccessToken
);
if
(
isAccessToken
)
{
ret
=
true
;
}
console
.
info
(
"
[wifi_test] disableHotspot:
"
+
wifiManagerExt
.
disableHotspot
())
expect
(
isAccessToken
).
assertFalse
();
done
();
}
catch
(
e
)
{
expect
(
ret
).
assertFalse
();
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0009 canIUse isAccessToken error:
"
+
e
);
}
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0009 end
'
);
done
();
})
/**
* @tc.number SUB_Communication_WiFi_SysCaps_Test_0010
* @tc.name testgetSupportedPowerModel
* @tc.desc Test getSupportedPowerModel api.
* @tc.type Function
*/
it
(
'
SUB_Communication_WiFi_SysCaps_Test_0010
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0010 start
'
);
let
ret
=
false
;
try
{
var
isAccessToken
=
canIUse
(
"
SystemCapability.Communication.WiFi.AP.Extension
"
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0010 test.syscap.param.001 :
"
+
isAccessToken
);
if
(
isAccessToken
)
{
ret
=
true
;
}
await
wifiManagerExt
.
getSupportedPowerModel
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test]getSupportedPowerModel promise result ->
"
+
JSON
.
stringify
(
data
));
});
expect
(
isAccessToken
).
assertFalse
();
done
();
}
catch
(
e
)
{
expect
(
ret
).
assertFalse
();
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0010 canIUse isAccessToken error:
"
+
e
);
}
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0010 end
'
);
done
();
})
/**
* @tc.number SUB_Communication_WiFi_SysCaps_Test_0011
* @tc.name testgetSupportedPowerModel
* @tc.desc Test getSupportedPowerModel api.
* @tc.type Function
*/
it
(
'
SUB_Communication_WiFi_SysCaps_Test_0011
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0011 start
'
);
let
ret
=
false
;
try
{
var
isAccessToken
=
canIUse
(
"
SystemCapability.Communication.WiFi.AP.Extension
"
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0011 test.syscap.param.001 :
"
+
isAccessToken
);
if
(
isAccessToken
)
{
ret
=
true
;
}
function
getSupportedPowerModelResult
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
wifiManagerExt
.
getSupportedPowerModel
(
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
info
(
"
[wifi_test]failed to getSupportedPowerModel:
"
+
JSON
.
stringify
(
err
));
expect
(
true
).
assertTrue
();
}
console
.
info
(
"
[wifi_test]getSupportedPowerModel callback:
"
+
JSON
.
stringify
(
result
));
resolve
();
});
});
}
await
getSupportedPowerModelResult
();
expect
(
isAccessToken
).
assertFalse
();
done
();
}
catch
(
e
)
{
expect
(
ret
).
assertFalse
();
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0011 canIUse isAccessToken error:
"
+
e
);
}
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0011 end
'
);
done
();
})
/**
* @tc.number SUB_Communication_WiFi_SysCaps_Test_0012
* @tc.name testgetPowerModel
* @tc.desc Test getPowerModel api.
* @tc.type Function
*/
it
(
'
SUB_Communication_WiFi_SysCaps_Test_0012
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0012 start
'
);
let
ret
=
false
;
try
{
var
isAccessToken
=
canIUse
(
"
SystemCapability.Communication.WiFi.AP.Extension
"
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0012 test.syscap.param.001 :
"
+
isAccessToken
);
if
(
isAccessToken
)
{
ret
=
true
;
}
await
wifiManagerExt
.
getPowerModel
()
.
then
(
data
=>
{
console
.
info
(
"
[wifi_test]getPowerModel promise result ->
"
+
JSON
.
stringify
(
data
));
});
expect
(
isAccessToken
).
assertFalse
();
done
();
}
catch
(
e
)
{
expect
(
ret
).
assertFalse
();
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0012 canIUse isAccessToken error:
"
+
e
);
}
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0012 end
'
);
done
();
})
/**
* @tc.number SUB_Communication_WiFi_SysCaps_Test_0013
* @tc.name testgetPowerModel
* @tc.desc Test getPowerModel api.
* @tc.type Function
*/
it
(
'
SUB_Communication_WiFi_SysCaps_Test_0013
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0013 start
'
);
let
ret
=
false
;
try
{
var
isAccessToken
=
canIUse
(
"
SystemCapability.Communication.WiFi.AP.Extension
"
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0013 test.syscap.param.001 :
"
+
isAccessToken
);
if
(
isAccessToken
)
{
ret
=
true
;
}
function
getPowerModelResult
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
wifiManagerExt
.
getPowerModel
(
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
info
(
"
[wifi_test]failed to getPowerModel:
"
+
JSON
.
stringify
(
err
));
expect
(
true
).
assertTrue
();
}
console
.
info
(
"
[wifi_test]getPowerModel callback:
"
+
JSON
.
stringify
(
result
));
resolve
();
});
});
}
await
getPowerModelResult
();
expect
(
isAccessToken
).
assertFalse
();
done
();
}
catch
(
e
)
{
expect
(
ret
).
assertFalse
();
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0013 canIUse isAccessToken error:
"
+
e
);
}
console
.
info
(
'
testSysCaps07 end
'
);
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0013 end
'
);
done
();
})
/**
* @tc.number SUB_Communication_WiFi_SysCaps_Test_0007
* @tc.name testsetPowerModel
* @tc.desc Test setPowerModel api.
* @tc.type Function
*/
it
(
'
SUB_Communication_WiFi_SysCaps_Test_0014
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0014 start
'
);
let
ret
=
false
;
try
{
var
isAccessToken
=
canIUse
(
"
SystemCapability.Communication.WiFi.AP.Extension
"
);
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0014 test.syscap.param.001 :
"
+
isAccessToken
);
if
(
isAccessToken
)
{
ret
=
true
;
}
console
.
info
(
"
[wifi_test] setPowerModel:
"
+
wifiManagerExt
.
setPowerModel
(
PowerModel
))
expect
(
isAccessToken
).
assertFalse
();
done
();
}
catch
(
e
)
{
expect
(
ret
).
assertFalse
();
console
.
info
(
"
SUB_Communication_WiFi_SysCaps_Test_0014 canIUse isAccessToken error:
"
+
e
);
}
console
.
info
(
'
SUB_Communication_WiFi_SysCaps_Test_0014 end
'
);
done
();
})
console
.
log
(
"
*************[wifi_test] start wifi js unit test end*************
"
);
...
...
@@ -389,4 +605,3 @@ export default function actsWifiEventTest() {
}
鸿蒙社区
@harmonycommunity
mentioned in commit
bc0ee698
·
11月 07, 2022
mentioned in commit
bc0ee698
mentioned in commit bc0ee698aefb56debc4641f024b0ac0fd0b3504a
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录