Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
cb391745
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看板
提交
cb391745
编写于
2月 01, 2023
作者:
Z
zhijianwen
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--slot--
Signed-off-by:
N
zhijianwen
<
zhijianwen@huawei.com
>
上级
39147fb2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
137 addition
and
128 deletion
+137
-128
notification/ans_standard/actsNotificationManagerSlotTest/src/main/js/test/ActsNotificationManagerSlotTest.js
...tTest/src/main/js/test/ActsNotificationManagerSlotTest.js
+93
-120
notification/ans_standard/actsNotificationSlotTest/src/main/js/test/ActsNotificationSlotTest.js
...tionSlotTest/src/main/js/test/ActsNotificationSlotTest.js
+44
-8
未找到文件。
notification/ans_standard/actsNotificationManagerSlotTest/src/main/js/test/ActsNotificationManagerSlotTest.js
浏览文件 @
cb391745
...
...
@@ -20,6 +20,10 @@ export default function ActsNotificationManagerSlotTest() {
let
TAG
=
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST ===>
'
console
.
info
(
TAG
+
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST START
'
)
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
))
}
afterEach
(
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
afterEach START`
)
try
{
...
...
@@ -1359,73 +1363,50 @@ export default function ActsNotificationManagerSlotTest() {
*/
it
(
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST_4700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST_4700 START
'
)
try
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
SOCIAL_COMMUNICATION
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION success`
)
expect
(
true
).
assertTrue
()
}
})
}
catch
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION errCode:
${
err
}
, errMes:
${
err
.
message
}
`
)
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
SOCIAL_COMMUNICATION
).
then
(()
=>
{
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION success`
)
expect
(
true
).
assertTrue
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
}
)
try
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
SERVICE_INFORMATION
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION success`
)
expect
(
true
).
assertTrue
()
}
})
}
catch
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION errCode:
${
err
}
, errMes:
${
err
.
message
}
`
)
await
sleep
(
1000
)
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
SERVICE_INFORMATION
).
then
(()
=>
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION success`
)
expect
(
true
).
assertTrue
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
}
)
try
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
CONTENT_INFORMATION
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION success`
)
expect
(
true
).
assertTrue
()
}
})
}
catch
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION errCode:
${
err
}
, errMes:
${
err
.
message
}
`
)
await
sleep
(
1000
)
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
CONTENT_INFORMATION
).
then
(()
=>
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION success`
)
expect
(
true
).
assertTrue
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
}
)
try
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
OTHER_TYPES
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES err:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES success`
)
expect
(
true
).
assertTrue
()
}
})
}
catch
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES errCode:
${
err
}
, errMes:
${
err
.
message
}
`
)
await
sleep
(
1000
)
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
OTHER_TYPES
).
then
(()
=>
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES success`
)
expect
(
true
).
assertTrue
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES err:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
})
await
sleep
(
1000
)
try
{
await
notificationManager
.
getSlots
((
err
,
NotificationSlot
)
=>
{
...
...
@@ -1435,10 +1416,18 @@ export default function ActsNotificationManagerSlotTest() {
done
()
}
else
{
console
.
info
(
`
${
TAG
}
getSlots AsyncCallback success:`
+
JSON
.
stringify
(
NotificationSlot
))
expect
(
NotificationSlot
[
0
].
type
).
assertEqual
(
1
)
expect
(
NotificationSlot
[
1
].
type
).
assertEqual
(
2
)
expect
(
NotificationSlot
[
2
].
type
).
assertEqual
(
3
)
expect
(
NotificationSlot
[
3
].
type
).
assertEqual
(
65535
)
for
(
let
i
=
0
;
i
<
NotificationSlot
.
length
;
i
++
)
{
console
.
info
(
`
${
TAG
}
NotificationSlot[
${
i
}
].type:`
+
JSON
.
stringify
(
NotificationSlot
[
i
].
type
))
if
(
NotificationSlot
[
i
].
type
==
1
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
1
)
}
else
if
(
NotificationSlot
[
i
].
type
==
2
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
2
)
}
else
if
(
NotificationSlot
[
i
].
type
==
3
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
3
)
}
else
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
65535
)
}
}
done
()
}
})
...
...
@@ -1459,80 +1448,64 @@ export default function ActsNotificationManagerSlotTest() {
it
(
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST_4800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST_4800 START
'
)
try
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
SOCIAL_COMMUNICATION
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION success`
)
expect
(
true
).
assertTrue
()
}
})
}
catch
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION errCode:
${
err
}
, errMes:
${
err
.
message
}
`
)
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
SOCIAL_COMMUNICATION
).
then
(()
=>
{
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION success`
)
expect
(
true
).
assertTrue
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
}
)
try
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
SERVICE_INFORMATION
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION success`
)
expect
(
true
).
assertTrue
()
}
})
}
catch
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION errCode:
${
err
}
, errMes:
${
err
.
message
}
`
)
await
sleep
(
1000
)
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
SERVICE_INFORMATION
).
then
(()
=>
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION success`
)
expect
(
true
).
assertTrue
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
}
)
try
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
CONTENT_INFORMATION
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION success`
)
expect
(
true
).
assertTrue
()
}
})
}
catch
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION errCode:
${
err
}
, errMes:
${
err
.
message
}
`
)
await
sleep
(
1000
)
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
CONTENT_INFORMATION
).
then
(()
=>
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION success`
)
expect
(
true
).
assertTrue
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
}
)
try
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
OTHER_TYPES
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES err:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES success`
)
expect
(
true
).
assertTrue
()
}
})
}
catch
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES errCode:
${
err
}
, errMes:
${
err
.
message
}
`
)
await
sleep
(
1000
)
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
OTHER_TYPES
).
then
(()
=>
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES success`
)
expect
(
true
).
assertTrue
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES err:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
})
await
sleep
(
1000
)
await
notificationManager
.
getSlots
().
then
((
NotificationSlot
)
=>
{
console
.
info
(
`
${
TAG
}
getSlots Promise success:`
+
JSON
.
stringify
(
NotificationSlot
))
expect
(
NotificationSlot
[
0
].
type
).
assertEqual
(
1
)
expect
(
NotificationSlot
[
1
].
type
).
assertEqual
(
2
)
expect
(
NotificationSlot
[
2
].
type
).
assertEqual
(
3
)
expect
(
NotificationSlot
[
3
].
type
).
assertEqual
(
65535
)
for
(
let
i
=
0
;
i
<
NotificationSlot
.
length
;
i
++
)
{
console
.
info
(
`
${
TAG
}
NotificationSlot[
${
i
}
].type:`
+
JSON
.
stringify
(
NotificationSlot
[
i
].
type
))
if
(
NotificationSlot
[
i
].
type
==
1
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
1
)
}
else
if
(
NotificationSlot
[
i
].
type
==
2
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
2
)
}
else
if
(
NotificationSlot
[
i
].
type
==
3
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
3
)
}
else
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
65535
)
}
}
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getSlots Promise err:
${
err
}
, errMes:
${
err
.
message
}
`
)
...
...
notification/ans_standard/actsNotificationSlotTest/src/main/js/test/ActsNotificationSlotTest.js
浏览文件 @
cb391745
...
...
@@ -20,6 +20,10 @@ export default function ActsNotificationSlotTest() {
let
TAG
=
'
SUB_NOTIFICATION_ANS_SLOT_TEST ===>
'
console
.
info
(
TAG
+
'
SUB_NOTIFICATION_ANS_SLOT_TEST START
'
)
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
))
}
afterEach
(
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
afterEach START`
)
await
notification
.
removeAllSlots
((
err
)
=>
{
...
...
@@ -1220,6 +1224,8 @@ export default function ActsNotificationSlotTest() {
}
})
await
sleep
(
1000
)
await
notification
.
addSlot
(
notification
.
SlotType
.
SERVICE_INFORMATION
,
(
err
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION err: +
${
err
.
code
}
`
)
...
...
@@ -1231,6 +1237,8 @@ export default function ActsNotificationSlotTest() {
}
})
await
sleep
(
1000
)
await
notification
.
addSlot
(
notification
.
SlotType
.
CONTENT_INFORMATION
,
(
err
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION err: +
${
err
.
code
}
`
)
...
...
@@ -1242,6 +1250,8 @@ export default function ActsNotificationSlotTest() {
}
})
await
sleep
(
1000
)
await
notification
.
addSlot
(
notification
.
SlotType
.
OTHER_TYPES
,
(
err
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES err: +
${
err
.
code
}
`
)
...
...
@@ -1253,6 +1263,8 @@ export default function ActsNotificationSlotTest() {
}
})
await
sleep
(
1000
)
await
notification
.
getSlots
((
err
,
NotificationSlot
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getSlots AsyncCallback err: +
${
err
.
code
}
`
)
...
...
@@ -1260,10 +1272,18 @@ export default function ActsNotificationSlotTest() {
done
()
}
else
{
console
.
info
(
`
${
TAG
}
getSlots AsyncCallback success:`
+
JSON
.
stringify
(
NotificationSlot
))
expect
(
NotificationSlot
[
0
].
type
).
assertEqual
(
1
)
expect
(
NotificationSlot
[
1
].
type
).
assertEqual
(
2
)
expect
(
NotificationSlot
[
2
].
type
).
assertEqual
(
3
)
expect
(
NotificationSlot
[
3
].
type
).
assertEqual
(
65535
)
for
(
let
i
=
0
;
i
<
NotificationSlot
.
length
;
i
++
)
{
console
.
info
(
`
${
TAG
}
NotificationSlot[
${
i
}
].type:`
+
JSON
.
stringify
(
NotificationSlot
[
i
].
type
))
if
(
NotificationSlot
[
i
].
type
==
1
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
1
)
}
else
if
(
NotificationSlot
[
i
].
type
==
2
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
2
)
}
else
if
(
NotificationSlot
[
i
].
type
==
3
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
3
)
}
else
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
65535
)
}
}
done
()
}
})
...
...
@@ -1290,6 +1310,8 @@ export default function ActsNotificationSlotTest() {
}
})
await
sleep
(
1000
)
await
notification
.
addSlot
(
notification
.
SlotType
.
SERVICE_INFORMATION
,
(
err
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION err: +
${
err
.
code
}
`
)
...
...
@@ -1301,6 +1323,8 @@ export default function ActsNotificationSlotTest() {
}
})
await
sleep
(
1000
)
await
notification
.
addSlot
(
notification
.
SlotType
.
CONTENT_INFORMATION
,
(
err
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION err: +
${
err
.
code
}
`
)
...
...
@@ -1312,6 +1336,8 @@ export default function ActsNotificationSlotTest() {
}
})
await
sleep
(
1000
)
await
notification
.
addSlot
(
notification
.
SlotType
.
OTHER_TYPES
,
(
err
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES err: +
${
err
.
code
}
`
)
...
...
@@ -1323,12 +1349,22 @@ export default function ActsNotificationSlotTest() {
}
})
await
sleep
(
1000
)
await
notification
.
getSlots
().
then
((
NotificationSlot
)
=>
{
console
.
info
(
`
${
TAG
}
getSlots Promise success:`
+
JSON
.
stringify
(
NotificationSlot
))
expect
(
NotificationSlot
[
0
].
type
).
assertEqual
(
1
)
expect
(
NotificationSlot
[
1
].
type
).
assertEqual
(
2
)
expect
(
NotificationSlot
[
2
].
type
).
assertEqual
(
3
)
expect
(
NotificationSlot
[
3
].
type
).
assertEqual
(
65535
)
for
(
let
i
=
0
;
i
<
NotificationSlot
.
length
;
i
++
)
{
console
.
info
(
`
${
TAG
}
NotificationSlot[
${
i
}
].type:`
+
JSON
.
stringify
(
NotificationSlot
[
i
].
type
))
if
(
NotificationSlot
[
i
].
type
==
1
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
1
)
}
else
if
(
NotificationSlot
[
i
].
type
==
2
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
2
)
}
else
if
(
NotificationSlot
[
i
].
type
==
3
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
3
)
}
else
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
65535
)
}
}
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getSlots Promise err: +
${
err
.
code
}
`
)
...
...
鸿蒙社区
@harmonycommunity
mentioned in commit
e51273c2
·
2月 04, 2023
mentioned in commit
e51273c2
mentioned in commit e51273c2f8b7e85cd0aac4590074d74665c29715
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录