Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f10d5a96
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看板
未验证
提交
f10d5a96
编写于
8月 24, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 24, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5119 【XTS】【事件通知子系统】属性整改_monthly
Merge pull request !5119 from zhijianwen/monthly_20220816
上级
357e4315
2777484f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
379 addition
and
249 deletion
+379
-249
notification/ans_standard/actsnotificationshow/src/main/js/test/ActsNotificationShowTest.js
...ficationshow/src/main/js/test/ActsNotificationShowTest.js
+81
-75
notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/test/actsansdistributedtest.js
...istributedtest/src/main/js/test/actsansdistributedtest.js
+298
-174
未找到文件。
notification/ans_standard/actsnotificationshow/src/main/js/test/ActsNotificationShowTest.js
浏览文件 @
f10d5a96
...
...
@@ -77,26 +77,27 @@ export default function ActsNotificationShowTest() {
*/
it
(
'
ActsNotificationShowTest_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
ActsNotificationShowTest_0400 START
'
)
let
ActionResult
=
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
'
/
'
}
let
ShowNotificationOptions
=
{
contentTitle
:
'
Title4
'
,
contentText
:
'
This is a notification 004
'
,
ActionResult
:
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
'
/
'
,
}
clickAction
:
ActionResult
}
notification
.
show
(
ShowNotificationOptions
)
console
.
info
(
TAG
+
'
conteneTitle:
'
+
ShowNotificationOptions
.
contentTitle
)
console
.
info
(
TAG
+
'
contentText:
'
+
ShowNotificationOptions
.
contentText
)
console
.
info
(
TAG
+
'
ActionResult bundleName:
'
+
ShowNotificationOptions
.
ActionResult
.
bundleName
)
console
.
info
(
TAG
+
'
ActionResult abilityName:
'
+
ShowNotificationOptions
.
ActionResult
.
abilityName
)
console
.
info
(
TAG
+
'
ActionResult uri:
'
+
ShowNotificationOptions
.
ActionResult
.
uri
)
console
.
info
(
TAG
+
'
ActionResult bundleName:
'
+
ShowNotificationOptions
.
clickAction
.
bundleName
)
console
.
info
(
TAG
+
'
ActionResult abilityName:
'
+
ShowNotificationOptions
.
clickAction
.
abilityName
)
console
.
info
(
TAG
+
'
ActionResult uri:
'
+
ShowNotificationOptions
.
clickAction
.
uri
)
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
(
'
/
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
bundleName
).
assertEqual
(
'
com.example.notification
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
uri
).
assertEqual
(
'
/
'
)
done
()
})
...
...
@@ -107,26 +108,27 @@ export default function ActsNotificationShowTest() {
*/
it
(
'
ActsNotificationShowTest_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
ActsNotificationShowTest_0500 START
'
)
let
ActionResult
=
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
'
pages/index/index
'
}
let
ShowNotificationOptions
=
{
contentTitle
:
'
Title5
'
,
contentText
:
'
This is a notification 005
'
,
ActionResult
:
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
'
pages/index/index
'
,
}
clickAction
:
ActionResult
}
notification
.
show
(
ShowNotificationOptions
)
console
.
info
(
TAG
+
'
conteneTitle:
'
+
ShowNotificationOptions
.
contentTitle
)
console
.
info
(
TAG
+
'
contentText:
'
+
ShowNotificationOptions
.
contentText
)
console
.
info
(
TAG
+
'
ActionResult bundleName:
'
+
ShowNotificationOptions
.
ActionResult
.
bundleName
)
console
.
info
(
TAG
+
'
ActionResult abilityName:
'
+
ShowNotificationOptions
.
ActionResult
.
abilityName
)
console
.
info
(
TAG
+
'
ActionResult uri:
'
+
ShowNotificationOptions
.
ActionResult
.
uri
)
console
.
info
(
TAG
+
'
ActionResult bundleName:
'
+
ShowNotificationOptions
.
clickAction
.
bundleName
)
console
.
info
(
TAG
+
'
ActionResult abilityName:
'
+
ShowNotificationOptions
.
clickAction
.
abilityName
)
console
.
info
(
TAG
+
'
ActionResult uri:
'
+
ShowNotificationOptions
.
clickAction
.
uri
)
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
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
bundleName
).
assertEqual
(
'
com.example.notification
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
uri
).
assertEqual
(
'
pages/index/index
'
)
done
()
})
...
...
@@ -137,25 +139,26 @@ export default function ActsNotificationShowTest() {
*/
it
(
'
ActsNotificationShowTest_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
ActsNotificationShowTest_0600 START
'
)
let
ActionResult
=
{
bundleName
:
''
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
'
/
'
,
}
let
ShowNotificationOptions
=
{
contentTitle
:
'
Title6
'
,
contentText
:
'
This is a notification 006
'
,
ActionResult
:
{
bundleName
:
''
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
'
/
'
,
}
clickAction
:
ActionResult
}
notification
.
show
(
ShowNotificationOptions
)
console
.
info
(
TAG
+
'
conteneTitle:
'
+
ShowNotificationOptions
.
contentTitle
)
console
.
info
(
TAG
+
'
contentText:
'
+
ShowNotificationOptions
.
contentText
)
console
.
info
(
TAG
+
'
ActionResult bundleName:
'
+
ShowNotificationOptions
.
ActionResult
.
bundleName
)
console
.
info
(
TAG
+
'
ActionResult abilityName:
'
+
ShowNotificationOptions
.
ActionResult
.
abilityName
)
console
.
info
(
TAG
+
'
ActionResult uri:
'
+
ShowNotificationOptions
.
ActionResult
.
uri
)
console
.
info
(
TAG
+
'
ActionResult bundleName:
'
+
ShowNotificationOptions
.
clickAction
.
bundleName
)
console
.
info
(
TAG
+
'
ActionResult abilityName:
'
+
ShowNotificationOptions
.
clickAction
.
abilityName
)
console
.
info
(
TAG
+
'
ActionResult uri:
'
+
ShowNotificationOptions
.
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
(
'
/
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
uri
).
assertEqual
(
'
/
'
)
done
()
})
...
...
@@ -166,25 +169,26 @@ export default function ActsNotificationShowTest() {
*/
it
(
'
ActsNotificationShowTest_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
ActsNotificationShowTest_0700 START
'
)
let
ActionResult
=
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
''
,
uri
:
'
/
'
,
}
let
ShowNotificationOptions
=
{
contentTitle
:
'
Title7
'
,
contentText
:
'
This is a notification 007
'
,
ActionResult
:
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
''
,
uri
:
'
/
'
,
}
clickAction
:
ActionResult
}
notification
.
show
(
ShowNotificationOptions
)
console
.
info
(
TAG
+
'
conteneTitle:
'
+
ShowNotificationOptions
.
contentTitle
)
console
.
info
(
TAG
+
'
contentText:
'
+
ShowNotificationOptions
.
contentText
)
console
.
info
(
TAG
+
'
ActionResult bundleName:
'
+
ShowNotificationOptions
.
ActionResult
.
bundleName
)
console
.
info
(
TAG
+
'
ActionResult abilityName:
'
+
ShowNotificationOptions
.
ActionResult
.
abilityName
)
console
.
info
(
TAG
+
'
ActionResult uri:
'
+
ShowNotificationOptions
.
ActionResult
.
uri
)
console
.
info
(
TAG
+
'
ActionResult bundleName:
'
+
ShowNotificationOptions
.
clickAction
.
bundleName
)
console
.
info
(
TAG
+
'
ActionResult abilityName:
'
+
ShowNotificationOptions
.
clickAction
.
abilityName
)
console
.
info
(
TAG
+
'
ActionResult uri:
'
+
ShowNotificationOptions
.
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
(
'
/
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
bundleName
).
assertEqual
(
'
com.example.notification
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
uri
).
assertEqual
(
'
/
'
)
done
()
})
...
...
@@ -195,25 +199,26 @@ export default function ActsNotificationShowTest() {
*/
it
(
'
ActsNotificationShowTest_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
ActsNotificationShowTest_0800 START
'
)
let
ActionResult
=
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
''
,
}
let
ShowNotificationOptions
=
{
contentTitle
:
'
Title8
'
,
contentText
:
'
This is a notification 008
'
,
ActionResult
:
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
''
,
}
clickAction
:
ActionResult
}
notification
.
show
(
ShowNotificationOptions
)
console
.
info
(
TAG
+
'
conteneTitle:
'
+
ShowNotificationOptions
.
contentTitle
)
console
.
info
(
TAG
+
'
contentText:
'
+
ShowNotificationOptions
.
contentText
)
console
.
info
(
TAG
+
'
ActionResult bundleName:
'
+
ShowNotificationOptions
.
ActionResult
.
bundleName
)
console
.
info
(
TAG
+
'
ActionResult abilityName:
'
+
ShowNotificationOptions
.
ActionResult
.
abilityName
)
console
.
info
(
TAG
+
'
ActionResult uri:
'
+
ShowNotificationOptions
.
ActionResult
.
uri
)
console
.
info
(
TAG
+
'
ActionResult bundleName:
'
+
ShowNotificationOptions
.
clickAction
.
bundleName
)
console
.
info
(
TAG
+
'
ActionResult abilityName:
'
+
ShowNotificationOptions
.
clickAction
.
abilityName
)
console
.
info
(
TAG
+
'
ActionResult uri:
'
+
ShowNotificationOptions
.
clickAction
.
uri
)
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
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
bundleName
).
assertEqual
(
'
com.example.notification
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
)
done
()
})
...
...
@@ -224,23 +229,24 @@ export default function ActsNotificationShowTest() {
*/
it
(
'
ActsNotificationShowTest_0900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
ActsNotificationShowTest_0900 START
'
)
let
ActionResult
=
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
'
/
'
,
}
let
ShowNotificationOptions
=
{
contentText
:
'
This is a notification 009
'
,
ActionResult
:
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
'
/
'
,
}
clickAction
:
ActionResult
}
notification
.
show
(
ShowNotificationOptions
)
console
.
info
(
TAG
+
'
contentText:
'
+
ShowNotificationOptions
.
contentText
)
console
.
info
(
TAG
+
'
ActionResult bundleName:
'
+
ShowNotificationOptions
.
ActionResult
.
bundleName
)
console
.
info
(
TAG
+
'
ActionResult abilityName:
'
+
ShowNotificationOptions
.
ActionResult
.
abilityName
)
console
.
info
(
TAG
+
'
ActionResult uri:
'
+
ShowNotificationOptions
.
ActionResult
.
uri
)
console
.
info
(
TAG
+
'
ActionResult bundleName:
'
+
ShowNotificationOptions
.
clickAction
.
bundleName
)
console
.
info
(
TAG
+
'
ActionResult abilityName:
'
+
ShowNotificationOptions
.
clickAction
.
abilityName
)
console
.
info
(
TAG
+
'
ActionResult uri:
'
+
ShowNotificationOptions
.
clickAction
.
uri
)
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
(
'
/
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
bundleName
).
assertEqual
(
'
com.example.notification
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
uri
).
assertEqual
(
'
/
'
)
done
()
})
...
...
@@ -251,23 +257,24 @@ export default function ActsNotificationShowTest() {
*/
it
(
'
ActsNotificationShowTest_1000
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
ActsNotificationShowTest_1000 START
'
)
let
ActionResult
=
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
'
/
'
,
}
let
ShowNotificationOptions
=
{
contentTitle
:
'
Title10
'
,
ActionResult
:
{
bundleName
:
'
com.example.notification
'
,
abilityName
:
'
com.example.notification.MainAbility
'
,
uri
:
'
/
'
,
}
clickAction
:
ActionResult
}
notification
.
show
(
ShowNotificationOptions
)
console
.
info
(
TAG
+
'
conteneTitle:
'
+
ShowNotificationOptions
.
contentTitle
)
console
.
info
(
TAG
+
'
ActionResult bundleName:
'
+
ShowNotificationOptions
.
ActionResult
.
bundleName
)
console
.
info
(
TAG
+
'
ActionResult abilityName:
'
+
ShowNotificationOptions
.
ActionResult
.
abilityName
)
console
.
info
(
TAG
+
'
ActionResult uri:
'
+
ShowNotificationOptions
.
ActionResult
.
uri
)
console
.
info
(
TAG
+
'
ActionResult bundleName:
'
+
ShowNotificationOptions
.
clickAction
.
bundleName
)
console
.
info
(
TAG
+
'
ActionResult abilityName:
'
+
ShowNotificationOptions
.
clickAction
.
abilityName
)
console
.
info
(
TAG
+
'
ActionResult uri:
'
+
ShowNotificationOptions
.
clickAction
.
uri
)
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
(
'
/
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
bundleName
).
assertEqual
(
'
com.example.notification
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
abilityName
).
assertEqual
(
'
com.example.notification.MainAbility
'
)
expect
(
ShowNotificationOptions
.
clickAction
.
uri
).
assertEqual
(
'
/
'
)
done
()
})
...
...
@@ -275,5 +282,4 @@ export default function ActsNotificationShowTest() {
})
}
notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/test/actsansdistributedtest.js
浏览文件 @
f10d5a96
...
...
@@ -14,192 +14,316 @@
*/
import
notify
from
'
@ohos.notification
'
import
wantAgent
from
'
@ohos.wantAgent
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
var
timeout
=
1800
;
export
default
function
ActsAnsDistributeTest
()
{
describe
(
'
ActsAnsDistributeTest
'
,
function
()
{
describe
(
'
ActsAnsDistributeTest
'
,
function
()
{
/*
* @tc.number: ActsDistribute_test_0100
* @tc.name: enableDistributed()
* @tc.desc: verify the function of enableDistributed,isDistributedEnabled
*/
it
(
'
ActsDistribute_test_0100
'
,
0
,
async
function
(
done
)
{
await
notify
.
enableDistributed
(
false
,
async
()
=>
{
await
notify
.
isDistributedEnabled
((
err
,
data
)
=>
{
console
.
log
(
"
===>ActsDistribute_test_0100 success===>
"
+
err
+
data
)
expect
(
data
).
assertEqual
(
false
)
done
();
/*
* @tc.number: ActsDistribute_test_0100
* @tc.name: enableDistributed()
* @tc.desc: verify the function of enableDistributed,isDistributedEnabled
*/
it
(
'
ActsDistribute_test_0100
'
,
0
,
async
function
(
done
)
{
await
notify
.
enableDistributed
(
false
,
async
()
=>
{
await
notify
.
isDistributedEnabled
((
err
,
data
)
=>
{
console
.
log
(
"
===>ActsDistribute_test_0100 success===>
"
+
err
+
data
)
expect
(
data
).
assertEqual
(
false
)
done
();
})
})
})
})
/*
* @tc.number: ActsDistribute_test_0200
* @tc.name: enableDistributedByBundle()
* @tc.desc: verify the function of enableDistributedByBundle,isDistributedEnableByBundle
*/
it
(
'
ActsDistribute_test_0200
'
,
0
,
async
function
(
done
)
{
await
notify
.
enableDistributedByBundle
({
bundle
:
"
com.example.actsansdistributetest
"
},
true
,
async
()
=>
{
await
notify
.
isDistributedEnableByBundle
({
bundle
:
"
com.example.actsansdistributetest
"
,
},(
err
,
data
)
=>
{
console
.
log
(
"
===>ActsDistribute_test_0200 success===>
"
+
err
+
data
)
expect
(
data
).
assertEqual
(
true
)
done
();
/*
* @tc.number: ActsDistribute_test_0200
* @tc.name: enableDistributedByBundle()
* @tc.desc: verify the function of enableDistributedByBundle,isDistributedEnableByBundle
*/
it
(
'
ActsDistribute_test_0200
'
,
0
,
async
function
(
done
)
{
await
notify
.
enableDistributedByBundle
(
{
bundle
:
"
com.example.actsansdistributetest
"
},
true
,
async
()
=>
{
await
notify
.
isDistributedEnableByBundle
(
{
bundle
:
"
com.example.actsansdistributetest
"
,
},(
err
,
data
)
=>
{
console
.
log
(
"
===>ActsDistribute_test_0200 success===>
"
+
err
+
data
)
expect
(
data
).
assertEqual
(
true
)
done
();
})
})
})
})
/*
* @tc.number: ActsDistribute_test_0300
* @tc.name: getDeviceRemindType()
* @tc.desc: verify the function of getDeviceRemindType
*/
it
(
'
ActsDistribute_test_0300
'
,
0
,
async
function
(
done
)
{
await
notify
.
getDeviceRemindType
((
err
,
data
)
=>
{
console
.
debug
(
"
===>ActsDistribute_test_0300===>
"
+
JSON
.
stringify
(
data
))
if
(
data
!=
notify
.
DeviceRemindType
.
IDLE_DONOT_REMIND
&&
data
!=
notify
.
DeviceRemindType
.
IDLE_REMIND
&&
data
!=
notify
.
DeviceRemindType
.
ACTIVE_DONOT_REMIND
&&
data
!=
notify
.
DeviceRemindType
.
ACTIVE_REMIND
)
{
expect
().
assertFail
();
}
done
();
});
})
/*
* @tc.number: ActsDistribute_test_0400
* @tc.name: publish()
* @tc.desc: verify the function of publish
*/
it
(
'
ActsDistribute_test_0400
'
,
0
,
async
function
(
done
)
{
function
onConsume0100
(
data
)
{
console
.
info
(
"
========ActsDistribute_test_0400 onConsume data:=======>
"
+
JSON
.
stringify
(
data
));
if
(
data
.
request
.
distributedOptions
.
remindType
!=
notify
.
DeviceRemindType
.
IDLE_DONOT_REMIND
&&
data
.
request
.
distributedOptions
.
remindType
!=
notify
.
DeviceRemindType
.
IDLE_REMIND
&&
data
.
request
.
distributedOptions
.
remindType
!=
notify
.
DeviceRemindType
.
ACTIVE_DONOT_REMIND
&&
data
.
request
.
distributedOptions
.
remindType
!=
notify
.
DeviceRemindType
.
ACTIVE_REMIND
)
{
expect
().
assertFail
();
}
expect
(
data
.
request
.
deviceId
).
assertEqual
(
""
);
console
.
info
(
"
ActsDistribute_test_0400 onConsume data
"
+
JSON
.
stringify
(
data
.
request
.
notificationFlags
));
expect
(
JSON
.
stringify
(
data
.
request
.
notificationFlags
)).
assertEqual
(
undefined
);
}
await
notify
.
enableDistributed
(
true
);
await
notify
.
enableDistributedSelf
(
true
);
console
.
info
(
"
==================ActsDistribute_test_0400 start==================>
"
);
var
subscriber
=
{
onConsume
:
onConsume0100
,
}
await
notify
.
subscribe
(
subscriber
);
var
notificationRequest
=
{
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test13_title
"
,
text
:
"
test13_text
"
,
additionalText
:
"
test13_additionalText
"
/*
* @tc.number: ActsDistribute_test_0300
* @tc.name: getDeviceRemindType()
* @tc.desc: verify the function of getDeviceRemindType
*/
it
(
'
ActsDistribute_test_0300
'
,
0
,
async
function
(
done
)
{
await
notify
.
getDeviceRemindType
((
err
,
data
)
=>
{
console
.
debug
(
"
===>ActsDistribute_test_0300===>
"
+
JSON
.
stringify
(
data
))
if
(
data
!=
notify
.
DeviceRemindType
.
IDLE_DONOT_REMIND
&&
data
!=
notify
.
DeviceRemindType
.
IDLE_REMIND
&&
data
!=
notify
.
DeviceRemindType
.
ACTIVE_DONOT_REMIND
&&
data
!=
notify
.
DeviceRemindType
.
ACTIVE_REMIND
)
{
expect
().
assertFail
();
}
done
();
});
})
/*
* @tc.number: ActsDistribute_test_0400
* @tc.name: publish()
* @tc.desc: verify the function of publish
*/
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
)
{
expect
().
assertFail
();
}
expect
(
data
.
request
.
deviceId
).
assertEqual
(
""
);
console
.
info
(
"
ActsDistribute_test_0400 onConsume data
"
+
JSON
.
stringify
(
data
.
request
.
notifyFlags
));
expect
(
JSON
.
stringify
(
data
.
request
.
notifyFlags
)).
assertEqual
(
undefined
);
}
await
notify
.
enableDistributed
(
true
);
await
notify
.
enableDistributedSelf
(
true
);
console
.
info
(
"
==================ActsDistribute_test_0400 start==================>
"
);
var
subscriber
=
{
onConsume
:
onConsume0100
,
}
await
notify
.
subscribe
(
subscriber
);
let
DistributedOptions
=
{
isDistributed
:
true
,
supportDisplayDevices
:
[
"
0
"
],
supportOperateDevices
:
[
"
0
"
]
}
var
notifyRequest
=
{
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test13_title
"
,
text
:
"
test13_text
"
,
additionalText
:
"
test13_additionalText
"
}
},
id
:
4
,
label
:
"
ANS_PublishBasicText_0100
"
,
slotType
:
notify
.
SlotType
.
CONTENT_INFORMATION
,
distributedOption
:
DistributedOptions
}
await
notify
.
publish
(
notificationRequest
);
console
.
info
(
"
===========ActsDistribute_test_0400 publish promise========>
"
);
setTimeout
((
async
function
(){
console
.
info
(
"
======ActsDistribute_test_0400 setTimeout==============>
"
);
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ActsDistribute_test_0400 setTimeout unsubscribe==>
"
);
done
();
}),
timeout
);
})
/*
* @tc.number: ActsDistribute_test_0500
* @tc.name: onEnabledNotificationChanged()
* @tc.desc: verify the function of onEnabledNotificationChanged
*/
it
(
'
ActsDistribute_test_0500
'
,
0
,
async
function
(
done
)
{
function
onEnablednotifyChanged001
(
data
){
console
.
log
(
"
===>onEnablednotifyChanged001 success===>
"
+
JSON
.
stringify
(
data
))
console
.
log
(
"
===>onEnablednotifyChanged001 bundle===>
"
+
JSON
.
stringify
(
data
.
bundle
))
console
.
log
(
"
===>onEnablednotifyChanged001 uid===>
"
+
JSON
.
stringify
(
data
.
uid
))
console
.
log
(
"
===>onEnablednotifyChanged001 enable===>
"
+
JSON
.
stringify
(
data
.
enable
))
expect
(
JSON
.
stringify
(
data
.
bundle
)).
assertEqual
(
"
com.example.actsansdistributetest
"
);
expect
(
JSON
.
stringify
(
data
.
uid
)).
assertEqual
(
"
454231
"
);
expect
(
JSON
.
stringify
(
data
.
enable
)).
assertEqual
(
true
);
}
function
connectCallbacka
()
{
console
.
debug
(
"
==>connectCallbacka code==>
"
);
}
var
subscriber
=
{
onConnect
:
connectCallbacka
,
onEnablednotifyChanged
:
onEnablednotifyChanged001
,
}
await
notify
.
subscribe
(
subscriber
,
async
(
err
)
=>
{
console
.
debug
(
"
==>subscribeCallback code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
await
notify
.
requestEnablenotify
((
err
)
=>
{
console
.
log
(
"
===>ActsDistribute_test_0500 success===>
"
+
err
.
code
)
})
});
setTimeout
((
async
function
(){
console
.
info
(
"
======ActsDistribute_test_0500 setTimeout==============>
"
);
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ActsDistribute_test_0500 setTimeout unsubscribe==>
"
);
done
();
}),
timeout
);
})
/*
* @tc.number: ActsDistribute_test_0600
* @tc.name: Query whether the template exists
* @tc.desc: isSupportTemplate(templateName: string, callback: AsyncCallback<boolean>): void
*/
it
(
'
ActsDistribute_test_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
==>ActsDistribute_test_0600 start==>
"
);
var
templateName
=
'
/system/etc/notification_template/assets/js/downloadTemplate.js
'
;
function
isSupportTemplateCallback
(
err
,
data
)
{
if
(
err
)
{
console
.
error
(
"
isSupportTemplateCallback
"
+
err
.
code
);
}
else
{
expect
(
true
).
assertTrue
();
console
.
info
(
"
isSupportTemplateCallback
"
+
JSON
.
stringify
(
data
));
done
();
}
},
id
:
4
,
label
:
"
ANS_PublishBasicText_0100
"
,
slotType
:
notify
.
SlotType
.
CONTENT_INFORMATION
,
distributedOptions
:{
isDistributed
:
true
,
supportDisplayDevices
:
[
"
0
"
],
supportOperateDevices
:
[
"
0
"
]}
}
await
notify
.
publish
(
notificationRequest
);
console
.
info
(
"
===========ActsDistribute_test_0400 publish promise========>
"
);
setTimeout
((
async
function
(){
console
.
info
(
"
======ActsDistribute_test_0400 setTimeout==============>
"
);
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ActsDistribute_test_0400 setTimeout unsubscribe==>
"
);
done
();
}),
timeout
);
})
/*
* @tc.number: ActsDistribute_test_0500
* @tc.name: onEnabledNotificationChanged()
* @tc.desc: verify the function of onEnabledNotificationChanged
*/
it
(
'
ActsDistribute_test_0500
'
,
0
,
async
function
(
done
)
{
function
onEnabledNotificationChanged001
(
data
){
console
.
log
(
"
===>onEnabledNotificationChanged001 success===>
"
+
JSON
.
stringify
(
data
))
console
.
log
(
"
===>onEnabledNotificationChanged001 bundle===>
"
+
JSON
.
stringify
(
data
.
bundle
))
console
.
log
(
"
===>onEnabledNotificationChanged001 uid===>
"
+
JSON
.
stringify
(
data
.
uid
))
console
.
log
(
"
===>onEnabledNotificationChanged001 enable===>
"
+
JSON
.
stringify
(
data
.
enable
))
expect
(
JSON
.
stringify
(
data
.
bundle
)).
assertEqual
(
"
com.example.actsansdistributetest
"
);
expect
(
JSON
.
stringify
(
data
.
uid
)).
assertEqual
(
"
454231
"
);
expect
(
JSON
.
stringify
(
data
.
enable
)).
assertEqual
(
true
);
}
function
connectCallbacka
()
{
console
.
debug
(
"
==>connectCallbacka code==>
"
);
}
var
subscriber
=
{
onConnect
:
connectCallbacka
,
onEnabledNotificationChanged
:
onEnabledNotificationChanged001
,
}
await
notify
.
subscribe
(
subscriber
,
async
(
err
)
=>
{
console
.
debug
(
"
==>subscribeCallback code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
await
notify
.
requestEnableNotification
((
err
)
=>
{
console
.
log
(
"
===>ActsDistribute_test_0500 success===>
"
+
err
.
code
)
})
});
setTimeout
((
async
function
(){
console
.
info
(
"
======ActsDistribute_test_0500 setTimeout==============>
"
);
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ActsDistribute_test_0500 setTimeout unsubscribe==>
"
);
}
notify
.
isSupportTemplate
(
templateName
,
isSupportTemplateCallback
);
done
();
}),
timeout
);
})
/*
* @tc.number: ActsDistribute_test_0600
* @tc.name: Query whether the template exists
* @tc.desc: isSupportTemplate(templateName: string, callback: AsyncCallback<boolean>): void
*/
it
(
'
ActsDistribute_test_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
==>ActsDistribute_test_0600 start==>
"
);
var
templateName
=
'
/system/etc/notification_template/assets/js/downloadTemplate.js
'
;
function
isSupportTemplateCallback
(
err
,
data
)
{
if
(
err
)
{
console
.
error
(
"
isSupportTemplateCallback
"
+
err
.
code
);
}
else
{
expect
(
true
).
assertTrue
();
console
.
info
(
"
isSupportTemplateCallback
"
+
JSON
.
stringify
(
data
));
})
/*
* @tc.number: ActsDistribute_test_0700
* @tc.name: Query whether the template exists
* @tc.desc: isSupportTemplate(templateName: string): Promise<boolean>
*/
it
(
'
ActsDistribute_test_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
==>ActsDistribute_test_0700 start==>
"
);
var
templateName
=
'
/system/etc/notification_template/assets/js/downloadTemplate.js
'
;
notify
.
isSupportTemplate
(
templateName
).
then
((
data
)
=>
{
expect
(
data
).
assertEqual
(
false
);
console
.
info
(
"
isSupportTemplatePromise
"
);
console
.
info
(
"
==>ActsDistribute_test_0700 success==>
"
+
JSON
.
stringify
(
data
));
done
();
}
}
notify
.
isSupportTemplate
(
templateName
,
isSupportTemplateCallback
);
done
();
})
/*
* @tc.number: ActsDistribute_test_0700
* @tc.name: Query whether the template exists
* @tc.desc: isSupportTemplate(templateName: string): Promise<boolean>
*/
it
(
'
ActsDistribute_test_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
==>ActsDistribute_test_0700 start==>
"
);
var
templateName
=
'
/system/etc/notification_template/assets/js/downloadTemplate.js
'
;
notify
.
isSupportTemplate
(
templateName
).
then
((
data
)
=>
{
expect
(
data
).
assertEqual
(
false
);
console
.
info
(
"
isSupportTemplatePromise
"
);
console
.
info
(
"
==>ActsDistribute_test_0700 success==>
"
+
JSON
.
stringify
(
data
));
})
done
();
})
done
();
})
})
/*
* @tc.number: ActsDistribute_test_0800
* @tc.name: add NotificationActionButton
* @tc.desc: NotificationActionButton userInput inputKey
*/
it
(
'
ActsDistribute_test_0800
'
,
0
,
async
function
(
done
)
{
const
TAG
=
'
NotificationActionButton ===>
'
const
BundleOption
=
{
bundle
:
'
com.example.actsansdistributetest
'
}
await
notify
.
isNotificationEnabled
(
BundleOption
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
TAG
+
'
: isNotificationEnabled failed! Err.code ===>
'
+
JSON
.
stringify
(
err
.
code
))
console
.
info
(
TAG
+
'
: isNotificationEnabled failed! Err.message ===>
'
+
JSON
.
stringify
(
err
.
message
))
expect
(
false
).
assertTrue
()
}
else
{
console
.
info
(
TAG
+
'
: isNotificationEnabled success! Result ===>
'
+
JSON
.
stringify
(
data
))
expect
(
true
).
assertTrue
()
}
})
async
function
SubscribeCallbackData
(
data
)
{
console
.
info
(
TAG
+
'
: data ===>
'
+
JSON
.
stringify
(
data
))
console
.
info
(
TAG
+
'
: data.request.content.normal.title ===>
'
+
JSON
.
stringify
(
data
.
request
.
content
.
normal
.
title
))
console
.
info
(
TAG
+
'
: data.request.content.normal.text ===>
'
+
JSON
.
stringify
(
data
.
request
.
content
.
normal
.
text
))
console
.
info
(
TAG
+
'
: data.request.content.normal.additionalText ===>
'
+
JSON
.
stringify
(
data
.
request
.
content
.
normal
.
additionalText
))
console
.
info
(
TAG
+
'
: data.request.actionButtons[0].title ===>
'
+
JSON
.
stringify
(
data
.
request
.
actionButtons
[
0
].
title
))
expect
(
data
.
request
.
content
.
normal
.
title
).
assertEqual
(
'
title
'
);
expect
(
data
.
request
.
content
.
normal
.
text
).
assertEqual
(
'
text
'
);
expect
(
data
.
request
.
content
.
normal
.
additionalText
).
assertEqual
(
'
additionalText
'
);
expect
(
data
.
request
.
content
.
normal
.
creatorBundleName
).
assertEqual
(
BundleOption
.
bundle
);
expect
(
data
.
request
.
content
.
normal
.
creatorPid
!=
undefined
).
assertTrue
()
expect
(
data
.
request
.
content
.
normal
.
creatorUid
!=
undefined
).
assertTrue
()
expect
(
data
.
request
.
actionButtons
[
0
].
title
).
assertEqual
(
'
additionalText
'
);
expect
(
data
.
request
.
actionButtons
[
0
].
extras
.
wantAgentInfo_key_1
).
assertEqual
(
'
wantAgentInfo_key_1
'
)
expect
(
data
.
request
.
actionButtons
[
0
].
extras
.
wantAgentInfo_key_2
).
assertEqual
(
'
wantAgentInfo_key_2
'
)
expect
(
data
.
request
.
actionButtons
[
0
].
userInput
.
inputKey
).
assertEqual
(
'
Please input at this
'
)
expect
(
true
).
assertTrue
()
await
notify
.
unsubscribe
(
NotificationSubscriber
,
(
err
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
TAG
+
'
: unsubscribe failed! Err.code ===>
'
+
JSON
.
stringify
(
err
.
code
))
console
.
info
(
TAG
+
'
: unsubscribe failed! Err.message ===>
'
+
JSON
.
stringify
(
err
.
message
))
expect
(
false
).
assertTrue
()
done
()
}
else
{
console
.
info
(
TAG
+
'
: unsubscribe success!
'
)
expect
(
true
).
assertTrue
()
}
})
}
let
NotificationSubscriber
=
{
onConsume
:
SubscribeCallbackData
}
await
notify
.
subscribe
(
NotificationSubscriber
,
(
err
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
TAG
+
'
: subscribe failed! Err.code ===>
'
+
JSON
.
stringify
(
err
.
code
))
console
.
info
(
TAG
+
'
: subscribe failed! Err.message ===>
'
+
JSON
.
stringify
(
err
.
message
))
expect
(
false
).
assertTrue
()
}
else
{
console
.
info
(
TAG
+
'
: subscribe success!
'
)
expect
(
true
).
assertTrue
()
done
()
}
})
let
wantAgentInfo
=
{
wants
:
[
{
bundleName
:
'
com.example.actsansdistributetest
'
,
abilityName
:
'
com.example.actsansdistributetest.TestAbility
'
}
],
operationType
:
wantAgent
.
OperationType
.
START_ABILITY
,
requestCode
:
0
,
wantAgentFlags
:
[
wantAgent
.
WantAgentFlags
.
UPDATE_PRESENT_FLAG
],
extraInfo
:
{
key_1
:
'
value_1
'
,
key_2
:
'
value_2
'
,
}
}
let
wantAgentInstance
=
await
wantAgent
.
getWantAgent
(
wantAgentInfo
)
const
NotificationRequest
=
{
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
'
title
'
,
text
:
'
text
'
,
additionalText
:
'
additionalText
'
},
},
actionButtons
:
[
{
title
:
'
activeButton_title
'
,
wantAgent
:
wantAgentInstance
,
extras
:
{
wantAgentInfo_key_1
:
'
wantAgentInfo_key_1
'
,
wantAgentInfo_key_2
:
'
wantAgentInfo_key_2
'
,
},
userInput
:
{
inputKey
:
'
Please input at this
'
}
}
],
}
await
notify
.
publish
(
NotificationRequest
,
(
err
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
TAG
+
'
: publish failed! Err.code ===>
'
+
JSON
.
stringify
(
err
.
code
))
console
.
info
(
TAG
+
'
: publish failed! Err.message ===>
'
+
JSON
.
stringify
(
err
.
message
))
expect
(
false
).
assertTrue
()
}
else
{
console
.
info
(
TAG
+
'
: publish successd!
'
)
expect
(
true
).
assertTrue
()
}
})
})
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录