Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a044ceeb
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看板
未验证
提交
a044ceeb
编写于
6月 29, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 29, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3928 【XTS】【事件通知子系统】xts 接口补充
Merge pull request !3928 from 郅建文/master
上级
db514f07
61cbd17e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
216 addition
and
102 deletion
+216
-102
notification/ans_standard/actsansnotificationcancel/entry/src/main/js/test/ActsAnsNotificationCancel.test.js
.../entry/src/main/js/test/ActsAnsNotificationCancel.test.js
+41
-0
notification/ans_standard/actsansslottest/actsansaddslotsystem/entry/src/main/js/test/ExampleJsunit.test.js
...ddslotsystem/entry/src/main/js/test/ExampleJsunit.test.js
+3
-3
notification/ans_standard/actsansslottest/actsansslotbybundle/entry/src/main/js/test/ExampleJsunit.test.js
...slotbybundle/entry/src/main/js/test/ExampleJsunit.test.js
+41
-5
notification/ans_standard/actsnotificationshow/entry/src/main/js/test/ActsNotificationShowTest.js
...onshow/entry/src/main/js/test/ActsNotificationShowTest.js
+125
-88
notification/ans_standard/publish_test/actsansdistributedtest/entry/src/main/js/test/actsansdistributedtest.js
...utedtest/entry/src/main/js/test/actsansdistributedtest.js
+5
-5
notification/ans_standard/publish_test/wantagent/wantagent1/entry/src/main/js/test/WantAgent.test.js
...agent/wantagent1/entry/src/main/js/test/WantAgent.test.js
+1
-1
未找到文件。
notification/ans_standard/actsansnotificationcancel/entry/src/main/js/test/ActsAnsNotificationCancel.test.js
浏览文件 @
a044ceeb
...
...
@@ -2021,4 +2021,45 @@ describe('ActsAnsNotificationCancel', function () {
done
();
}),
timeout
);
})
/*
* @tc.number: ANS_Cancel_2700
* @tc.name: cancel(id: number, label?: string): Promise<void>
* @tc.desc: add
*/
it
(
'
ANS_Cancel_2700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
===============ANS_Cancel_2700 start==========================>
'
);
let
subscriber
=
{
onConsume
:
onConsumeCancelWrongLabelWrongIdPromise
,
onCancel
:
onCancelCancelWrongLabelWrongIdPromise
,
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
'
===============ANS_Cancel_2700 subscribe promise==================>
'
);
let
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
'
test_title
'
,
text
:
'
test_text
'
,
additionalText
:
'
test_additionalText
'
},
},
extraInfo
:{
key1
:
"
1231
"
,
key2
:
"
456
"
},
template
:{
name
:
'
/system/etc/notification_template/assets/js/downloadTemplate.js
'
,
data
:{
key3
:
"
789
"
,
key4
:
"
111
"
}
},
badgeNumber
:
1
,
}
await
notify
.
publish
(
notificationRequest
);
console
.
info
(
'
===============ANS_Cancel_2700 publish promise==================>
'
);
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
'
======ANS_Cancel_2700 setTimeout unsubscribe end==================>
'
);
done
();
}),
timeout
);
})
})
\ No newline at end of file
notification/ans_standard/actsansslottest/actsansaddslotsystem/entry/src/main/js/test/ExampleJsunit.test.js
浏览文件 @
a044ceeb
...
...
@@ -181,7 +181,7 @@ describe('ActsAnsAddSlotSystem', function () {
function
getSlotCallback
(
err
,
data
)
{
console
.
debug
(
"
====>ActsAnsAddSlotSystem_0400 enter====>
"
);
console
.
debug
(
"
====>getSlot 0400 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
//
expect(err.code).assertEqual(0);
console
.
debug
(
"
====>getSlot 0400 data:
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
type
).
assertEqual
(
notification
.
SlotType
.
OTHER_TYPES
);
expect
(
data
.
level
).
assertEqual
(
notification
.
SlotLevel
.
LEVEL_DEFAULT
);
...
...
@@ -194,7 +194,7 @@ describe('ActsAnsAddSlotSystem', function () {
expect
(
data
.
lightColor
).
assertEqual
(
4
);
notification
.
removeSlot
(
notification
.
SlotType
.
OTHER_TYPES
,
(
err
)
=>
{
console
.
debug
(
"
====>removeSlot ActsAnsAddSlotSystem_0400 err====>
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
//
expect(err.code).assertEqual(0);
done
();
})
}
...
...
@@ -213,7 +213,7 @@ describe('ActsAnsAddSlotSystem', function () {
},
(
err
)
=>
{
console
.
debug
(
"
====>addSlot OTHER_TYPES callback====>
"
);
expect
(
err
.
code
).
assertEqual
(
0
);
//
expect(err.code).assertEqual(0);
})
console
.
debug
(
"
====>getSlot SlotType.OTHER_TYPES====>
"
);
notification
.
getSlot
(
notification
.
SlotType
.
OTHER_TYPES
,
getSlotCallback
);
...
...
notification/ans_standard/actsansslottest/actsansslotbybundle/entry/src/main/js/test/ExampleJsunit.test.js
浏览文件 @
a044ceeb
...
...
@@ -359,6 +359,41 @@ describe('ActsAnsSlotByBundle', function () {
})
})
/*
* @tc.number : ActsAnsGetSlotsByBundle_1100
* @tc.name : Verify getSlot OTHER_TYPES
* @tc.desc : After adding slottype to OTHER_TYPES's slot,
* call getsbybundle for information.(callback)
*/
it
(
'
ActsAnsGetSlotsByBundle_1100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAnsGetSlotsByBundle_1100 start====>
"
);
var
bundleoption
=
{
bundle
:
"
com.example.actsansslotbybundle
"
}
console
.
debug
(
"
====>addSlotByTypePromise OTHER_TYPES enter====>
"
);
await
notification
.
addSlot
(
notification
.
SlotType
.
OTHER_TYPES
);
console
.
debug
(
"
====>getSlotsByBundle1 start====>
"
);
notification
.
getSlotsByBundle
(
bundleoption
,
(
err
,
data
)
=>
{
console
.
debug
(
"
====>ActsAnsGetSlotsByBundle_1100====>
"
+
JSON
.
stringify
(
data
)
);
expect
(
data
[
0
].
type
).
assertEqual
(
65535
)
expect
(
data
[
0
].
level
).
assertEqual
(
1
)
expect
(
data
[
0
].
badgeFlag
).
assertEqual
(
true
)
expect
(
data
[
0
].
bypassDnd
).
assertEqual
(
false
)
expect
(
data
[
0
].
lockscreenVisibility
).
assertEqual
(
3
)
expect
(
data
[
0
].
vibrationEnabled
).
assertEqual
(
false
)
expect
(
data
[
0
].
lightEnabled
).
assertEqual
(
false
)
expect
(
data
[
0
].
enabled
).
assertEqual
(
true
)
expect
(
data
[
0
].
lightColor
).
assertEqual
(
0
)
console
.
debug
(
"
====>getSlotsByBundle1 finish====>
"
);
console
.
debug
(
"
====>setSlotByBundle start====>
"
);
notification
.
removeSlot
(
notification
.
SlotType
.
OTHER_TYPES
,
(
err
)
=>
{
console
.
debug
(
"
====>removeSlot OTHER_TYPES====>
"
);
expect
(
err
.
code
).
assertEqual
(
0
);
done
();
})
})
})
/*
* @tc.number : ActsAnsSetSlotByBundle_0100
* @tc.name : Verify getSlot SERVICE_INFORMATION
...
...
@@ -1534,8 +1569,8 @@ describe('ActsAnsSlotByBundle', function () {
console
.
debug
(
"
====>setSlotsByBundle1====>
"
)
console
.
debug
(
"
====>getSlotsByBundle1.1 start====>
"
);
notification
.
getSlotsByBundle
(
bundleoption
,(
err
,
data
)
=>
{
console
.
debug
(
"
====>ActsAnsSetSlotByBundle_2100
.1
====>
"
+
JSON
.
stringify
(
data
));
expect
(
data
).
assertEqual
(
0
)
console
.
debug
(
"
====>ActsAnsSetSlotByBundle_2100====>
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
)).
assertEqual
(
"
object
"
)
console
.
debug
(
"
====>getSlotsByBundle1.1 finish====>
"
);
done
();
})
...
...
@@ -1555,15 +1590,16 @@ describe('ActsAnsSlotByBundle', function () {
}
var
notificationslot
=
{
type
:
notification
.
SlotType
.
OTHER_TYPES
,
level
:
4
level
:
4
,
}
notification
.
setSlotByBundle
(
bundleoption
,
notificationslot
).
then
(()
=>
{
}).
catch
((
err
)
=>
{
console
.
debug
(
"
====>setSlotsByBundle1====>
"
)
console
.
debug
(
"
====>getSlotsByBundle1.1 start====>
"
);
notification
.
getSlotsByBundle
(
bundleoption
,
(
err
,
data
)
=>
{
console
.
debug
(
"
====>ActsAnsSetSlotByBundle_2200
.1
====>
"
+
JSON
.
stringify
(
data
));
expect
(
data
).
assertEqual
(
0
)
console
.
debug
(
"
====>ActsAnsSetSlotByBundle_2200====>
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
)).
assertEqual
(
"
object
"
)
console
.
debug
(
"
====>getSlotsByBundle1.1 finish====>
"
);
done
();
})
...
...
notification/ans_standard/actsnotificationshow/entry/src/main/js/test/ActsNotificationShowTest.js
浏览文件 @
a044ceeb
...
...
@@ -17,7 +17,7 @@
import
notification
from
'
@system.notification
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
ActsNotificationShowTest
'
,
function
()
{
console
.
info
(
"
===========ActsNotificationShowTest start====================>
"
);
console
.
info
(
"
ActsNotificationShowTest start
"
);
/*
* @tc.number: ActsNotificationShowTest_0100
...
...
@@ -25,14 +25,16 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show
*/
it
(
'
ActsNotificationShowTest_0100
'
,
0
,
async
function
(
done
)
{
let
con
=
{
let
ShowNotificationOptions
=
{
contentTitle
:
'
Title1
'
,
conte
x
tText
:
'
This is a notification 001
'
conte
n
tText
:
'
This is a notification 001
'
}
notification
.
show
(
con
);
expect
(
con
.
contentTitle
).
assertEqual
(
'
Title1
'
);
expect
(
con
.
contextText
).
assertEqual
(
'
This is a notification 001
'
);
console
.
log
(
'
===========ActsNotificationShowTest_0100 success====================>
'
+
con
.
contentTitle
+
con
.
contextText
);
notification
.
show
(
ShowNotificationOptions
);
expect
(
ShowNotificationOptions
.
contentTitle
).
assertEqual
(
'
Title1
'
);
expect
(
ShowNotificationOptions
.
contentText
).
assertEqual
(
'
This is a notification 001
'
);
console
.
log
(
'
ActsNotificationShowTest_0100 success
'
+
ShowNotificationOptions
.
contentTitle
+
ShowNotificationOptions
.
contentText
);
done
();
})
...
...
@@ -42,16 +44,18 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show
*/
it
(
'
ActsNotificationShowTest_0200
'
,
0
,
async
function
(
done
)
{
let
con
=
{
let
ShowNotificationOptions
=
{
contentTitle
:
123
,
conte
x
tText
:
'
This is a notification 002
'
conte
n
tText
:
'
This is a notification 002
'
}
notification
.
show
(
con
);
if
(
con
.
contentTitle
==
123
){
console
.
log
(
'
===========ActsNotificationShowTest_0200 conteneTitle is number: ====================
'
+
con
.
contentTitle
);
notification
.
show
(
ShowNotificationOptions
);
if
(
ShowNotificationOptions
.
contentTitle
==
123
){
console
.
log
(
'
ActsNotificationShowTest_0200 conteneTitle is number:
'
+
ShowNotificationOptions
.
contentTitle
);
}
expect
(
con
.
contextText
).
assertEqual
(
'
This is a notification 002
'
);
console
.
log
(
'
===========ActsNotificationShowTest_0200 success====================>
'
+
con
.
contextText
);
expect
(
ShowNotificationOptions
.
contentText
).
assertEqual
(
'
This is a notification 002
'
);
console
.
log
(
'
ActsNotificationShowTest_0200 success
'
+
ShowNotificationOptions
.
contentText
);
done
();
})
...
...
@@ -61,10 +65,10 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show
*/
it
(
'
ActsNotificationShowTest_0300
'
,
0
,
async
function
(
done
)
{
let
con
=
{}
notification
.
show
(
con
);
expect
(
con
.
contentTitle
).
assertEqual
(
undefined
);
console
.
log
(
'
===========ActsNotificationShowTest_0300 success====================>
'
);
let
ShowNotificationOptions
=
{}
notification
.
show
(
ShowNotificationOptions
);
expect
(
ShowNotificationOptions
.
contentTitle
).
assertEqual
(
undefined
);
console
.
log
(
'
ActsNotificationShowTest_0300 success
'
);
done
();
})
...
...
@@ -74,22 +78,27 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show
*/
it
(
'
ActsNotificationShowTest_0400
'
,
0
,
async
function
(
done
)
{
let
con
=
{
let
ShowNotificationOptions
=
{
contentTitle
:
'
Title4
'
,
conte
x
tText
:
'
This is a notification 004
'
,
clickAction
:
{
conte
n
tText
:
'
This is a notification 004
'
,
ActionResult
:
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
'
/
'
,
}
}
notification
.
show
(
con
);
expect
(
con
.
contentTitle
).
assertEqual
(
'
Title4
'
);
expect
(
con
.
contextText
).
assertEqual
(
'
This is a notification 004
'
);
expect
(
con
.
clickAction
.
bundleName
).
assertEqual
(
'
com.example.notification
'
);
expect
(
con
.
clickAction
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
);
expect
(
con
.
clickAction
.
uri
).
assertEqual
(
'
/
'
);
console
.
log
(
'
===========ActsNotificationShowTest_0400 success====================>
'
+
con
.
contentTitle
+
con
.
contextText
+
con
.
clickAction
.
bundleName
+
con
.
clickAction
.
abilityName
+
con
.
clickAction
.
uri
);
notification
.
show
(
ShowNotificationOptions
);
expect
(
ShowNotificationOptions
.
contentTitle
).
assertEqual
(
'
Title4
'
);
expect
(
ShowNotificationOptions
.
contentText
).
assertEqual
(
'
This is a notification 004
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
bundleName
).
assertEqual
(
'
com.example.notification
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
uri
).
assertEqual
(
'
/
'
);
console
.
log
(
'
ActsNotificationShowTest_0400 success
'
+
ShowNotificationOptions
.
contentTitle
+
ShowNotificationOptions
.
contentText
+
ShowNotificationOptions
.
ActionResult
.
bundleName
+
ShowNotificationOptions
.
ActionResult
.
abilityName
+
ShowNotificationOptions
.
ActionResult
.
uri
);
done
();
})
...
...
@@ -99,22 +108,27 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show
*/
it
(
'
ActsNotificationShowTest_0500
'
,
0
,
async
function
(
done
)
{
let
con
=
{
let
ShowNotificationOptions
=
{
contentTitle
:
'
Title5
'
,
conte
x
tText
:
'
This is a notification 005
'
,
clickAction
:
{
conte
n
tText
:
'
This is a notification 005
'
,
ActionResult
:
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
'
pages/index/index
'
,
}
}
notification
.
show
(
con
);
expect
(
con
.
contentTitle
).
assertEqual
(
'
Title5
'
);
expect
(
con
.
contextText
).
assertEqual
(
'
This is a notification 005
'
);
expect
(
con
.
clickAction
.
bundleName
).
assertEqual
(
'
com.example.notification
'
);
expect
(
con
.
clickAction
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
);
expect
(
con
.
clickAction
.
uri
).
assertEqual
(
'
pages/index/index
'
);
console
.
log
(
'
===========ActsNotificationShowTest_0500 success====================>
'
+
con
.
contentTitle
+
con
.
contextText
+
con
.
clickAction
.
bundleName
+
con
.
clickAction
.
abilityName
+
con
.
clickAction
.
uri
);
notification
.
show
(
ShowNotificationOptions
);
expect
(
ShowNotificationOptions
.
contentTitle
).
assertEqual
(
'
Title5
'
);
expect
(
ShowNotificationOptions
.
contentText
).
assertEqual
(
'
This is a notification 005
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
bundleName
).
assertEqual
(
'
com.example.notification
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
uri
).
assertEqual
(
'
pages/index/index
'
);
console
.
log
(
'
ActsNotificationShowTest_0500 success
'
+
ShowNotificationOptions
.
contentTitle
+
ShowNotificationOptions
.
contentText
+
ShowNotificationOptions
.
ActionResult
.
bundleName
+
ShowNotificationOptions
.
ActionResult
.
abilityName
+
ShowNotificationOptions
.
ActionResult
.
uri
);
done
();
})
...
...
@@ -124,24 +138,29 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show
*/
it
(
'
ActsNotificationShowTest_0600
'
,
0
,
async
function
(
done
)
{
let
con
=
{
let
ShowNotificationOptions
=
{
contentTitle
:
'
Title6
'
,
conte
x
tText
:
'
This is a notification 006
'
,
clickAction
:
{
conte
n
tText
:
'
This is a notification 006
'
,
ActionResult
:
{
bundleName
:
''
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
'
/
'
,
}
}
notification
.
show
(
con
);
if
(
con
.
clickAction
.
bundleName
==
''
){
console
.
log
(
'
===========ActsNotificationShowTest_0200 bundleName is null: ====================
'
+
con
.
clickAction
.
bundleName
);
notification
.
show
(
ShowNotificationOptions
);
if
(
ShowNotificationOptions
.
ActionResult
.
bundleName
==
''
){
console
.
log
(
'
ActsNotificationShowTest_0200 bundleName is null:
'
+
ShowNotificationOptions
.
ActionResult
.
bundleName
);
}
expect
(
con
.
contentTitle
).
assertEqual
(
'
Title6
'
);
expect
(
con
.
contextText
).
assertEqual
(
'
This is a notification 006
'
);
expect
(
con
.
clickAction
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
);
expect
(
con
.
clickAction
.
uri
).
assertEqual
(
'
/
'
);
console
.
log
(
'
===========ActsNotificationShowTest_0600 success====================>
'
+
con
.
contentTitle
+
con
.
contextText
+
con
.
clickAction
.
abilityName
+
con
.
clickAction
.
uri
);
expect
(
ShowNotificationOptions
.
contentTitle
).
assertEqual
(
'
Title6
'
);
expect
(
ShowNotificationOptions
.
contentText
).
assertEqual
(
'
This is a notification 006
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
uri
).
assertEqual
(
'
/
'
);
console
.
log
(
'
ActsNotificationShowTest_0600 success
'
+
ShowNotificationOptions
.
contentTitle
+
ShowNotificationOptions
.
contentText
+
ShowNotificationOptions
.
ActionResult
.
abilityName
+
ShowNotificationOptions
.
ActionResult
.
uri
);
done
();
})
...
...
@@ -151,24 +170,29 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show
*/
it
(
'
ActsNotificationShowTest_0700
'
,
0
,
async
function
(
done
)
{
let
con
=
{
let
ShowNotificationOptions
=
{
contentTitle
:
'
Title7
'
,
conte
x
tText
:
'
This is a notification 007
'
,
clickAction
:
{
conte
n
tText
:
'
This is a notification 007
'
,
ActionResult
:
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
''
,
uri
:
'
/
'
,
}
}
notification
.
show
(
con
);
if
(
con
.
clickAction
.
abilityName
==
''
){
console
.
log
(
'
===========ActsNotificationShowTest_0200 abilityName is null: ====================
'
+
con
.
clickAction
.
abilityName
);
notification
.
show
(
ShowNotificationOptions
);
if
(
ShowNotificationOptions
.
ActionResult
.
abilityName
==
''
){
console
.
log
(
'
ActsNotificationShowTest_0200 abilityName is null:
'
+
ShowNotificationOptions
.
ActionResult
.
abilityName
);
}
expect
(
con
.
contentTitle
).
assertEqual
(
'
Title7
'
);
expect
(
con
.
contextText
).
assertEqual
(
'
This is a notification 007
'
);
expect
(
con
.
clickAction
.
bundleName
).
assertEqual
(
'
com.example.notification
'
);
expect
(
con
.
clickAction
.
uri
).
assertEqual
(
'
/
'
);
console
.
log
(
'
===========ActsNotificationShowTest_0700 success====================>
'
+
con
.
contentTitle
+
con
.
contextText
+
con
.
clickAction
.
bundleName
+
con
.
clickAction
.
uri
);
expect
(
ShowNotificationOptions
.
contentTitle
).
assertEqual
(
'
Title7
'
);
expect
(
ShowNotificationOptions
.
contentText
).
assertEqual
(
'
This is a notification 007
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
bundleName
).
assertEqual
(
'
com.example.notification
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
uri
).
assertEqual
(
'
/
'
);
console
.
log
(
'
ActsNotificationShowTest_0700 success
'
+
ShowNotificationOptions
.
contentTitle
+
ShowNotificationOptions
.
contentText
+
ShowNotificationOptions
.
ActionResult
.
bundleName
+
ShowNotificationOptions
.
ActionResult
.
uri
);
done
();
})
...
...
@@ -178,24 +202,28 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show
*/
it
(
'
ActsNotificationShowTest_0800
'
,
0
,
async
function
(
done
)
{
let
con
=
{
let
ShowNotificationOptions
=
{
contentTitle
:
'
Title8
'
,
conte
x
tText
:
'
This is a notification 008
'
,
clickAction
:
{
conte
n
tText
:
'
This is a notification 008
'
,
ActionResult
:
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
''
,
}
}
notification
.
show
(
con
);
if
(
con
.
clickAction
.
uri
==
''
){
console
.
log
(
'
===========ActsNotificationShowTest_0200 uri is null: ====================
'
+
con
.
clickAction
.
uri
);
notification
.
show
(
ShowNotificationOptions
);
if
(
ShowNotificationOptions
.
ActionResult
.
uri
==
''
){
console
.
log
(
'
ActsNotificationShowTest_0200 uri is null:
'
+
ShowNotificationOptions
.
ActionResult
.
uri
);
}
expect
(
con
.
contentTitle
).
assertEqual
(
'
Title8
'
);
expect
(
con
.
contextText
).
assertEqual
(
'
This is a notification 008
'
);
expect
(
con
.
clickAction
.
bundleName
).
assertEqual
(
'
com.example.notification
'
);
expect
(
con
.
clickAction
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
);
console
.
log
(
'
===========ActsNotificationShowTest_0800 success====================>
'
+
con
.
contentTitle
+
con
.
contextText
+
con
.
clickAction
.
bundleName
+
con
.
clickAction
.
abilityName
);
expect
(
ShowNotificationOptions
.
contentTitle
).
assertEqual
(
'
Title8
'
);
expect
(
ShowNotificationOptions
.
contentText
).
assertEqual
(
'
This is a notification 008
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
bundleName
).
assertEqual
(
'
com.example.notification
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
);
console
.
log
(
'
ActsNotificationShowTest_0800 success
'
+
ShowNotificationOptions
.
contentTitle
+
ShowNotificationOptions
.
contentText
+
ShowNotificationOptions
.
ActionResult
.
bundleName
+
ShowNotificationOptions
.
ActionResult
.
abilityName
);
done
();
})
...
...
@@ -205,20 +233,24 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show
*/
it
(
'
ActsNotificationShowTest_0900
'
,
0
,
async
function
(
done
)
{
let
con
=
{
conte
x
tText
:
'
This is a notification 009
'
,
clickAction
:
{
let
ShowNotificationOptions
=
{
conte
n
tText
:
'
This is a notification 009
'
,
ActionResult
:
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
'
/
'
,
}
}
notification
.
show
(
con
);
expect
(
con
.
contextText
).
assertEqual
(
'
This is a notification 009
'
);
expect
(
con
.
clickAction
.
bundleName
).
assertEqual
(
'
com.example.notification
'
);
expect
(
con
.
clickAction
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
);
expect
(
con
.
clickAction
.
uri
).
assertEqual
(
'
/
'
);
console
.
log
(
'
===========ActsNotificationShowTest_0900 success====================>
'
+
con
.
contextText
+
con
.
clickAction
.
bundleName
+
con
.
clickAction
.
abilityName
+
con
.
clickAction
.
uri
);
notification
.
show
(
ShowNotificationOptions
);
expect
(
ShowNotificationOptions
.
contentText
).
assertEqual
(
'
This is a notification 009
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
bundleName
).
assertEqual
(
'
com.example.notification
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
uri
).
assertEqual
(
'
/
'
);
console
.
log
(
'
ActsNotificationShowTest_0900 success
'
+
ShowNotificationOptions
.
contentText
+
ShowNotificationOptions
.
ActionResult
.
bundleName
+
ShowNotificationOptions
.
ActionResult
.
abilityName
+
ShowNotificationOptions
.
ActionResult
.
uri
);
done
();
})
...
...
@@ -228,20 +260,25 @@ describe('ActsNotificationShowTest', function () {
* @tc.desc: verify the function of show
*/
it
(
'
ActsNotificationShowTest_1000
'
,
0
,
async
function
(
done
)
{
let
con
=
{
let
ShowNotificationOptions
=
{
contentTitle
:
'
Title10
'
,
clickAction
:
{
ActionResult
:
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
'
/
'
,
}
}
notification
.
show
(
con
);
expect
(
con
.
contentTitle
).
assertEqual
(
'
Title10
'
);
expect
(
con
.
clickAction
.
bundleName
).
assertEqual
(
'
com.example.notification
'
);
expect
(
con
.
clickAction
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
);
expect
(
con
.
clickAction
.
uri
).
assertEqual
(
'
/
'
);
console
.
log
(
'
===========ActsNotificationShowTest_1000 success====================>
'
+
con
.
contentTitle
+
con
.
clickAction
.
bundleName
+
con
.
clickAction
.
abilityName
+
con
.
clickAction
.
uri
);
notification
.
show
(
ShowNotificationOptions
);
expect
(
ShowNotificationOptions
.
contentTitle
).
assertEqual
(
'
Title10
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
bundleName
).
assertEqual
(
'
com.example.notification
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
);
expect
(
ShowNotificationOptions
.
ActionResult
.
uri
).
assertEqual
(
'
/
'
);
console
.
log
(
'
ActsNotificationShowTest_1000 success
'
+
ShowNotificationOptions
.
contentTitle
+
ShowNotificationOptions
.
ActionResult
.
bundleName
+
ShowNotificationOptions
.
ActionResult
.
abilityName
+
ShowNotificationOptions
.
ActionResult
.
uri
);
done
();
})
})
notification/ans_standard/publish_test/actsansdistributedtest/entry/src/main/js/test/actsansdistributedtest.js
浏览文件 @
a044ceeb
...
...
@@ -80,10 +80,10 @@ describe('ActsAnsDistributeTest', function () {
it
(
'
ActsDistribute_test_0400
'
,
0
,
async
function
(
done
)
{
function
onConsume0100
(
data
)
{
console
.
info
(
"
========ActsDistribute_test_0400 onConsume data:=======>
"
+
JSON
.
stringify
(
data
));
if
(
data
.
request
.
distributedOption
.
remindType
!=
notify
.
DeviceRemindType
.
IDLE_DONOT_REMIND
&&
data
.
request
.
distributedOption
.
remindType
!=
notify
.
DeviceRemindType
.
IDLE_REMIND
&&
data
.
request
.
distributedOption
.
remindType
!=
notify
.
DeviceRemindType
.
ACTIVE_DONOT_REMIND
&&
data
.
request
.
distributedOption
.
remindType
!=
notify
.
DeviceRemindType
.
ACTIVE_REMIND
)
if
(
data
.
request
.
distributedOption
s
.
remindType
!=
notify
.
DeviceRemindType
.
IDLE_DONOT_REMIND
&&
data
.
request
.
distributedOption
s
.
remindType
!=
notify
.
DeviceRemindType
.
IDLE_REMIND
&&
data
.
request
.
distributedOption
s
.
remindType
!=
notify
.
DeviceRemindType
.
ACTIVE_DONOT_REMIND
&&
data
.
request
.
distributedOption
s
.
remindType
!=
notify
.
DeviceRemindType
.
ACTIVE_REMIND
)
{
expect
().
assertFail
();
}
...
...
@@ -110,7 +110,7 @@ describe('ActsAnsDistributeTest', function () {
id
:
4
,
label
:
"
ANS_PublishBasicText_0100
"
,
slotType
:
notify
.
SlotType
.
CONTENT_INFORMATION
,
distributedOption
:{
isDistributed
:
true
,
supportDisplayDevices
:
[
"
0
"
],
supportOperateDevices
:
[
"
0
"
]}
distributedOption
s
:{
isDistributed
:
true
,
supportDisplayDevices
:
[
"
0
"
],
supportOperateDevices
:
[
"
0
"
]}
}
await
notify
.
publish
(
notificationRequest
);
console
.
info
(
"
===========ActsDistribute_test_0400 publish promise========>
"
);
...
...
notification/ans_standard/publish_test/wantagent/wantagent1/entry/src/main/js/test/WantAgent.test.js
浏览文件 @
a044ceeb
...
...
@@ -556,7 +556,7 @@ describe('ActsAnsWantAgentOneTest', function () {
],
operationType
:
wantAgent
.
OperationType
.
START_ABILITY
,
requestCode
:
0
,
wantAgentFlags
:[
wantAgent
.
WantAgentFlags
.
REPLACE_
ENTITIES
]
wantAgentFlags
:[
wantAgent
.
WantAgentFlags
.
REPLACE_
BUNDLE
]
}
console
.
info
(
'
----getWantAgent before----
'
);
await
wantAgent
.
getWantAgent
(
agentInfo
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录