Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8ccc5d1b
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看板
未验证
提交
8ccc5d1b
编写于
3月 16, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 16, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2502 【XTS】【事件通知子系统】ans新增自动化用例
Merge pull request !2502 from zhijianwen/master
上级
8816a5ed
802b0ca7
变更
46
显示空白变更内容
内联
并排
Showing
46 changed file
with
3988 addition
and
0 deletion
+3988
-0
notification/ans_standard/publish_test/BUILD.gn
notification/ans_standard/publish_test/BUILD.gn
+3
-0
notification/ans_standard/publish_test/actsansgetallactive/BUILD.gn
...on/ans_standard/publish_test/actsansgetallactive/BUILD.gn
+31
-0
notification/ans_standard/publish_test/actsansgetallactive/Test.json
...n/ans_standard/publish_test/actsansgetallactive/Test.json
+18
-0
notification/ans_standard/publish_test/actsansgetallactive/entry/.gitignore
...tandard/publish_test/actsansgetallactive/entry/.gitignore
+1
-0
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/config.json
...blish_test/actsansgetallactive/entry/src/main/config.json
+65
-0
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/app.js
...test/actsansgetallactive/entry/src/main/js/default/app.js
+22
-0
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/i18n/en-US.json
...ansgetallactive/entry/src/main/js/default/i18n/en-US.json
+6
-0
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/i18n/zh-CN.json
...ansgetallactive/entry/src/main/js/default/i18n/zh-CN.json
+6
-0
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/pages/index/index.css
...allactive/entry/src/main/js/default/pages/index/index.css
+9
-0
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/pages/index/index.hml
...allactive/entry/src/main/js/default/pages/index/index.hml
+8
-0
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/pages/index/index.js
...tallactive/entry/src/main/js/default/pages/index/index.js
+47
-0
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/resources/base/element/string.json
...tive/entry/src/main/js/resources/base/element/string.json
+12
-0
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/resources/base/media/icon.png
...allactive/entry/src/main/js/resources/base/media/icon.png
+0
-0
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/test/List.test.js
...t/actsansgetallactive/entry/src/main/js/test/List.test.js
+15
-0
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/test/getAllActive.js
...ctsansgetallactive/entry/src/main/js/test/getAllActive.js
+436
-0
notification/ans_standard/publish_test/actsansgetallactive/signature/openharmony_sx.p7b
...ish_test/actsansgetallactive/signature/openharmony_sx.p7b
+0
-0
notification/ans_standard/publish_test/publish/BUILD.gn
notification/ans_standard/publish_test/publish/BUILD.gn
+31
-0
notification/ans_standard/publish_test/publish/Test.json
notification/ans_standard/publish_test/publish/Test.json
+18
-0
notification/ans_standard/publish_test/publish/entry/.gitignore
...cation/ans_standard/publish_test/publish/entry/.gitignore
+1
-0
notification/ans_standard/publish_test/publish/entry/src/main/config.json
..._standard/publish_test/publish/entry/src/main/config.json
+62
-0
notification/ans_standard/publish_test/publish/entry/src/main/js/default/app.js
...ard/publish_test/publish/entry/src/main/js/default/app.js
+22
-0
notification/ans_standard/publish_test/publish/entry/src/main/js/default/i18n/en-US.json
...sh_test/publish/entry/src/main/js/default/i18n/en-US.json
+6
-0
notification/ans_standard/publish_test/publish/entry/src/main/js/default/i18n/zh-CN.json
...sh_test/publish/entry/src/main/js/default/i18n/zh-CN.json
+6
-0
notification/ans_standard/publish_test/publish/entry/src/main/js/default/pages/index/index.css
...t/publish/entry/src/main/js/default/pages/index/index.css
+9
-0
notification/ans_standard/publish_test/publish/entry/src/main/js/default/pages/index/index.hml
...t/publish/entry/src/main/js/default/pages/index/index.hml
+5
-0
notification/ans_standard/publish_test/publish/entry/src/main/js/default/pages/index/index.js
...st/publish/entry/src/main/js/default/pages/index/index.js
+47
-0
notification/ans_standard/publish_test/publish/entry/src/main/js/resources/base/element/string.json
...lish/entry/src/main/js/resources/base/element/string.json
+12
-0
notification/ans_standard/publish_test/publish/entry/src/main/js/resources/base/media/icon.png
...t/publish/entry/src/main/js/resources/base/media/icon.png
+0
-0
notification/ans_standard/publish_test/publish/entry/src/main/js/test/List.test.js
.../publish_test/publish/entry/src/main/js/test/List.test.js
+15
-0
notification/ans_standard/publish_test/publish/entry/src/main/js/test/publish.js
...rd/publish_test/publish/entry/src/main/js/test/publish.js
+2391
-0
notification/ans_standard/publish_test/publish/signature/openharmony_sx.p7b
...tandard/publish_test/publish/signature/openharmony_sx.p7b
+0
-0
notification/ans_standard/publish_test/sub/BUILD.gn
notification/ans_standard/publish_test/sub/BUILD.gn
+31
-0
notification/ans_standard/publish_test/sub/Test.json
notification/ans_standard/publish_test/sub/Test.json
+18
-0
notification/ans_standard/publish_test/sub/entry/.gitignore
notification/ans_standard/publish_test/sub/entry/.gitignore
+1
-0
notification/ans_standard/publish_test/sub/entry/src/main/config.json
.../ans_standard/publish_test/sub/entry/src/main/config.json
+62
-0
notification/ans_standard/publish_test/sub/entry/src/main/js/default/app.js
...tandard/publish_test/sub/entry/src/main/js/default/app.js
+22
-0
notification/ans_standard/publish_test/sub/entry/src/main/js/default/i18n/en-US.json
...ublish_test/sub/entry/src/main/js/default/i18n/en-US.json
+6
-0
notification/ans_standard/publish_test/sub/entry/src/main/js/default/i18n/zh-CN.json
...ublish_test/sub/entry/src/main/js/default/i18n/zh-CN.json
+6
-0
notification/ans_standard/publish_test/sub/entry/src/main/js/default/pages/index/index.css
..._test/sub/entry/src/main/js/default/pages/index/index.css
+9
-0
notification/ans_standard/publish_test/sub/entry/src/main/js/default/pages/index/index.hml
..._test/sub/entry/src/main/js/default/pages/index/index.hml
+5
-0
notification/ans_standard/publish_test/sub/entry/src/main/js/default/pages/index/index.js
...h_test/sub/entry/src/main/js/default/pages/index/index.js
+47
-0
notification/ans_standard/publish_test/sub/entry/src/main/js/resources/base/element/string.json
.../sub/entry/src/main/js/resources/base/element/string.json
+12
-0
notification/ans_standard/publish_test/sub/entry/src/main/js/resources/base/media/icon.png
..._test/sub/entry/src/main/js/resources/base/media/icon.png
+0
-0
notification/ans_standard/publish_test/sub/entry/src/main/js/test/List.test.js
...dard/publish_test/sub/entry/src/main/js/test/List.test.js
+15
-0
notification/ans_standard/publish_test/sub/entry/src/main/js/test/Subscriber.js
...ard/publish_test/sub/entry/src/main/js/test/Subscriber.js
+450
-0
notification/ans_standard/publish_test/sub/signature/openharmony_sx.p7b
...ns_standard/publish_test/sub/signature/openharmony_sx.p7b
+0
-0
未找到文件。
notification/ans_standard/publish_test/BUILD.gn
浏览文件 @
8ccc5d1b
...
...
@@ -26,11 +26,14 @@ group("publish_test") {
#"publishcontentype:publishcontentype",
#"subscribe:subscribe",
"activebtn:activebtn",
"actsansgetallactive:ActsAnsGetAllActiveTestXts",
"ansactscancelgroup:ActsAnsCancelGroupTest",
"ansactsremovegroup:ActsAnsRemoveGroupTest",
"donotdisturbmode:ActsAnsDoNotDisturbTest",
"publish:ActsAnsNotificationPublishXts",
"publishsound:ActsAnsPublishSoundTest",
"publishvibra:ActsAnsPublishVibraTest",
"sub:ActsAnsSubTestXts",
"unsubscribe:ActsAnsUnSubscriberTest",
"wantagent:wantagent",
]
...
...
notification/ans_standard/publish_test/actsansgetallactive/BUILD.gn
0 → 100644
浏览文件 @
8ccc5d1b
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAnsGetAllActiveTestXts") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsGetAllActiveTestXts"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
notification/ans_standard/publish_test/actsansgetallactive/Test.json
0 → 100644
浏览文件 @
8ccc5d1b
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"180000"
,
"package"
:
"com.example.actsansgetallactivetest"
,
"shell-timeout"
:
"60000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsAnsGetAllActiveTestXts.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
notification/ans_standard/publish_test/actsansgetallactive/entry/.gitignore
0 → 100644
浏览文件 @
8ccc5d1b
/build
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/config.json
0 → 100644
浏览文件 @
8ccc5d1b
{
"app"
:
{
"bundleName"
:
"com.example.actsansgetallactivetest"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1
,
"name"
:
"1.0"
},
"apiVersion"
:
{
"compatible"
:
5
,
"target"
:
5
,
"releaseType"
:
"Beta1"
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.example.actsansgetallactivetest"
,
"name"
:
".MyApplication"
,
"deviceType"
:
[
"phone"
],
"reqPermissions"
:
[{
"name"
:
"ohos.permission.NOTIFICATION_CONTROLLER"
}],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
},
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"name"
:
"com.example.actsansgetallactivetest.MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
"type"
:
"page"
,
"isVisible"
:
"true"
,
"launchType"
:
"standard"
,
"visible"
:
true
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/app.js
0 → 100644
浏览文件 @
8ccc5d1b
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export
default
{
onCreate
()
{
console
.
info
(
'
AceApplication onCreate
'
);
},
onDestroy
()
{
console
.
info
(
'
AceApplication onDestroy
'
);
}
};
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/i18n/en-US.json
0 → 100644
浏览文件 @
8ccc5d1b
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
}
}
\ No newline at end of file
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/i18n/zh-CN.json
0 → 100644
浏览文件 @
8ccc5d1b
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
}
}
\ No newline at end of file
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/pages/index/index.css
0 → 100644
浏览文件 @
8ccc5d1b
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/pages/index/index.hml
0 → 100644
浏览文件 @
8ccc5d1b
<div class="container">
<text class="title">
currentApp
</text>
<text class="title">
ForGetAllActive
</text>
</div>
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/pages/index/index.js
0 → 100644
浏览文件 @
8ccc5d1b
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
file
from
'
@system.file
'
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
const
injectRef
=
Object
.
getPrototypeOf
(
global
)
||
global
injectRef
.
regeneratorRuntime
=
require
(
'
@babel/runtime/regenerator
'
)
export
default
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
console
.
info
(
'
onShow finish
'
)
const
core
=
Core
.
getInstance
()
const
expectExtend
=
new
ExpectExtend
({
'
id
'
:
'
extend
'
})
core
.
addService
(
'
expect
'
,
expectExtend
)
core
.
init
()
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
require
(
'
../../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
console
.
info
(
'
onReady
'
);
},
}
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/resources/base/element/string.json
0 → 100644
浏览文件 @
8ccc5d1b
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"getAllActive"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/resources/base/media/icon.png
0 → 100644
浏览文件 @
8ccc5d1b
6.6 KB
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/test/List.test.js
0 → 100644
浏览文件 @
8ccc5d1b
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require
(
'
./getAllActive.js
'
)
\ No newline at end of file
notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/test/getAllActive.js
0 → 100644
浏览文件 @
8ccc5d1b
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
notify
from
'
@ohos.notification
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
var
time
=
500
describe
(
'
ActsAnsGetAllActiveTestXts
'
,
function
()
{
console
.
info
(
"
===========ActsAnsGetAllActiveTest start====================>
"
);
function
getAllCallback
(
err
,
data
){
console
.
log
(
"
Ans_GetAllActive_0100 getAllCallback ============>
"
);
var
i
;
console
.
log
(
"
Ans_GetAllActive_0100 getAllCallback data.length============>
"
+
data
.
length
);
expect
(
data
.
length
).
assertEqual
(
2
);
console
.
log
(
"
Ans_GetAllActive_0100 getAllCallback data============>
"
+
JSON
.
stringify
(
data
));
for
(
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
i
==
0
){
expect
(
data
[
i
].
content
.
normal
.
title
).
assertEqual
(
"
test_title_otherApp
"
);
console
.
log
(
"
=======Ans_GetAllActive_0100 getCallback title=====>
"
+
data
[
i
].
content
.
normal
.
title
)
expect
(
data
[
i
].
content
.
normal
.
text
).
assertEqual
(
"
test_text_otherApp
"
);
console
.
log
(
"
=======Ans_GetAllActive_0100 getCallback text========>
"
+
data
[
i
].
content
.
normal
.
text
)
expect
(
data
[
i
].
content
.
normal
.
additionalText
).
assertEqual
(
"
test_additionalText_otherApp
"
);
console
.
log
(
"
===Ans_GetAllActive_0100 getCallback text====>
"
+
data
[
i
].
content
.
normal
.
additionalText
)
expect
(
data
[
i
].
id
).
assertEqual
(
2
);
console
.
log
(
"
============Ans_GetAllActive_0100 getCallback id============>
"
+
data
[
i
].
id
)
expect
(
data
[
i
].
label
).
assertEqual
(
"
otherApp
"
);
console
.
log
(
"
============Ans_GetAllActive_0100 getCallback label=====>
"
+
data
[
i
].
label
)
}
else
if
(
i
==
1
){
expect
(
data
[
i
].
content
.
normal
.
title
).
assertEqual
(
"
test_title_currentApp
"
);
console
.
log
(
"
======Ans_GetAllActive_0100 getCallback title=========>
"
+
data
[
i
].
content
.
normal
.
title
)
expect
(
data
[
i
].
content
.
normal
.
text
).
assertEqual
(
"
test_text_currentApp
"
);
console
.
log
(
"
==========Ans_GetAllActive_0100 getCallback text=======>
"
+
data
[
i
].
content
.
normal
.
text
)
expect
(
data
[
i
].
content
.
normal
.
additionalText
).
assertEqual
(
"
test_additionalText_currentApp
"
);
console
.
log
(
"
===Ans_GetAllActive_0100 getCallback text=====>
"
+
data
[
i
].
content
.
normal
.
additionalText
)
expect
(
data
[
i
].
id
).
assertEqual
(
1
);
console
.
log
(
"
============Ans_GetAllActive_0100 getCallback id============>
"
+
data
[
i
].
id
)
expect
(
data
[
i
].
label
).
assertEqual
(
"
currentApp_0100
"
);
console
.
log
(
"
============Ans_GetAllActive_0100 getCallback label=====>
"
+
data
[
i
].
label
)
}
}
}
/*
* @tc.number: Ans_GetAllActive_xts_0100
* @tc.name: getAllActiveNotifications(callback: AsyncCallback<Array<NotificationRequest>>): void;
* @tc.desc: Verify: After the current app and other apps publish two notifications,
get all active notifications in the system(callback)
*/
it
(
'
Ans_GetAllActive_xts_0100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
===============Ans_GetAllActive_0100 start==================>
"
);
await
notify
.
cancelAll
();
var
notificationRequestOfOtherApp
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title_otherApp
"
,
text
:
"
test_text_otherApp
"
,
additionalText
:
"
test_additionalText_otherApp
"
},
},
id
:
2
,
label
:
"
otherApp
"
,
}
await
notify
.
publish
(
notificationRequestOfOtherApp
);
console
.
debug
(
"
===============Ans_GetAllActive_0100 publish OtherApp notify end==================>
"
);
var
notificationRequestOfCurrentApp
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title_currentApp
"
,
text
:
"
test_text_currentApp
"
,
additionalText
:
"
test_additionalText_currentApp
"
},
},
id
:
1
,
label
:
"
currentApp_0100
"
,
}
await
notify
.
publish
(
notificationRequestOfCurrentApp
);
console
.
debug
(
"
===============Ans_GetAllActive_0100 publish CurrentApp notify end==================>
"
);
notify
.
getAllActiveNotifications
(
getAllCallback
);
console
.
debug
(
"
===============Ans_GetAllActive_0100 getAllActiveNotifications end==================>
"
);
setTimeout
(
function
(){
console
.
debug
(
"
===============Ans_GetAllActive_0100 setTimeout==================>
"
);
done
();
},
time
);
})
/*
* @tc.number: Ans_GetAllActive_xts_0200
* @tc.name: getAllActiveNotifications(): Promise<Array<NotificationRequest>>
* @tc.desc: Verify: After the current app and other apps publish two notifications,
get all active notifications in the system(promise)
*/
it
(
'
Ans_GetAllActive_xts_0200
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
===============Ans_GetAllActive_0200 start==================>
"
);
await
notify
.
cancelAll
();
var
notificationRequestOfOtherApp
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title_otherApp
"
,
text
:
"
test_text_otherApp
"
,
additionalText
:
"
test_additionalText_otherApp
"
},
},
id
:
2
,
label
:
"
otherApp
"
,
}
await
notify
.
publish
(
notificationRequestOfOtherApp
);
console
.
debug
(
"
===============Ans_GetAllActive_0200 publish OtherApp notify end==================>
"
);
var
notificationRequestOfCurrentApp
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title_currentApp
"
,
text
:
"
test_text_currentApp
"
,
additionalText
:
"
test_additionalText_currentApp
"
},
},
id
:
1
,
label
:
"
currentApp_0200
"
,
}
await
notify
.
publish
(
notificationRequestOfCurrentApp
);
console
.
debug
(
"
===============Ans_GetAllActive_0200 publish CurrentApp notify end==================>
"
);
var
promiseData
=
await
notify
.
getAllActiveNotifications
();
console
.
debug
(
"
===============Ans_GetAllActive_0200 getActiveNotifications end==================>
"
);
expect
(
promiseData
.
length
).
assertEqual
(
2
);
var
i
;
for
(
i
=
0
;
i
<
promiseData
.
length
;
i
++
)
{
if
(
i
==
0
){
expect
(
promiseData
[
i
].
content
.
normal
.
title
).
assertEqual
(
"
test_title_otherApp
"
);
console
.
log
(
"
=======Ans_GetAllActive_0200 title=====>
"
+
promiseData
[
i
].
content
.
normal
.
title
)
expect
(
promiseData
[
i
].
content
.
normal
.
text
).
assertEqual
(
"
test_text_otherApp
"
);
console
.
log
(
"
=======Ans_GetAllActive_0200 text========>
"
+
promiseData
[
i
].
content
.
normal
.
text
)
expect
(
promiseData
[
i
].
content
.
normal
.
additionalText
).
assertEqual
(
"
test_additionalText_otherApp
"
);
console
.
log
(
"
===Ans_GetAllActive_0200 text====>
"
+
promiseData
[
i
].
content
.
normal
.
additionalText
)
expect
(
promiseData
[
i
].
id
).
assertEqual
(
2
);
console
.
log
(
"
============Ans_GetAllActive_0200 id============>
"
+
promiseData
[
i
].
id
)
expect
(
promiseData
[
i
].
label
).
assertEqual
(
"
otherApp
"
);
console
.
log
(
"
============Ans_GetAllActive_0200 label=====>
"
+
promiseData
[
i
].
label
)
}
else
if
(
i
==
1
){
expect
(
promiseData
[
i
].
content
.
normal
.
title
).
assertEqual
(
"
test_title_currentApp
"
);
console
.
log
(
"
====Ans_GetAllActive_0200 title=====>
"
+
promiseData
[
i
].
content
.
normal
.
title
)
expect
(
promiseData
[
i
].
content
.
normal
.
text
).
assertEqual
(
"
test_text_currentApp
"
);
console
.
log
(
"
======Ans_GetAllActive_0200 text=====>
"
+
promiseData
[
i
].
content
.
normal
.
text
)
expect
(
promiseData
[
i
].
content
.
normal
.
additionalText
).
assertEqual
(
"
test_additionalText_currentApp
"
);
console
.
log
(
"
Ans_GetAllActive_0200 text===>
"
+
promiseData
[
i
].
content
.
normal
.
additionalText
)
expect
(
promiseData
[
i
].
id
).
assertEqual
(
1
);
console
.
log
(
"
============Ans_GetAllActive_0200 id============>
"
+
promiseData
[
i
].
id
)
expect
(
promiseData
[
i
].
label
).
assertEqual
(
"
currentApp_0200
"
);
console
.
log
(
"
============Ans_GetAllActive_0200 label=====>
"
+
promiseData
[
i
].
label
)
}
}
setTimeout
(
function
(){
console
.
debug
(
"
===============Ans_GetAllActive_0200 setTimeout==================>
"
);
done
();
},
time
);
})
function
getAllCallbackThree
(
err
,
data
){
console
.
log
(
"
Ans_GetAllActive_0300 getAllCallbackThree ============>
"
);
console
.
log
(
"
Ans_GetAllActive_0300 getAllCallbackThree data.length============>
"
+
data
.
length
);
console
.
log
(
"
Ans_GetAllActive_0300 getAllCallbackThree data============>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
length
).
assertEqual
(
1
);
var
i
;
for
(
i
=
0
;
i
<
data
.
length
;
i
++
)
{
expect
(
data
[
i
].
content
.
normal
.
title
).
assertEqual
(
"
test_title_otherApp
"
);
console
.
log
(
"
==========Ans_GetAllActive_0300 getCallback title=========>
"
+
data
[
i
].
content
.
normal
.
title
)
expect
(
data
[
i
].
content
.
normal
.
text
).
assertEqual
(
"
test_text_otherApp
"
);
console
.
log
(
"
==========Ans_GetAllActive_0300 getCallback text============>
"
+
data
[
i
].
content
.
normal
.
text
)
expect
(
data
[
i
].
content
.
normal
.
additionalText
).
assertEqual
(
"
test_additionalText_otherApp
"
);
console
.
log
(
"
======Ans_GetAllActive_0300 getCallback text=======>
"
+
data
[
i
].
content
.
normal
.
additionalText
)
expect
(
data
[
i
].
id
).
assertEqual
(
2
);
console
.
log
(
"
============Ans_GetAllActive_0300 getCallback id============>
"
+
data
[
i
].
id
)
expect
(
data
[
i
].
label
).
assertEqual
(
"
otherApp
"
);
console
.
log
(
"
============Ans_GetAllActive_0300 getCallback label=====>
"
+
data
[
i
].
label
)
}
}
/*
* @tc.number: Ans_GetAllActive_xts_0300
* @tc.name: getAllActiveNotifications(callback: AsyncCallback<Array<NotificationRequest>>): void;
* @tc.desc: Verify: After the current app and other apps publish two notifications, cancel the notifications
of the current app, get all active notifications in the system(callback)
*/
it
(
'
Ans_GetAllActive_xts_0300
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
===============Ans_GetAllActive_0300 start==================>
"
);
await
notify
.
cancelAll
();
var
notificationRequestOfOtherApp
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title_otherApp
"
,
text
:
"
test_text_otherApp
"
,
additionalText
:
"
test_additionalText_otherApp
"
},
},
id
:
2
,
label
:
"
otherApp
"
,
}
await
notify
.
publish
(
notificationRequestOfOtherApp
);
console
.
debug
(
"
===============Ans_GetAllActive_0300 publish OtherApp notify end==================>
"
);
var
notificationRequestOfCurrentApp
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title_currentApp
"
,
text
:
"
test_text_currentApp
"
,
additionalText
:
"
test_additionalText_currentApp
"
},
},
id
:
1
,
label
:
"
currentApp_0300
"
,
}
await
notify
.
publish
(
notificationRequestOfCurrentApp
);
console
.
debug
(
"
===============Ans_GetAllActive_0300 publish CurrentApp notify end==================>
"
);
await
notify
.
cancel
(
1
,
"
currentApp_0300
"
);
notify
.
getAllActiveNotifications
(
getAllCallbackThree
);
console
.
debug
(
"
===============Ans_GetAllActive_0300 getAllActiveNotifications end==================>
"
);
setTimeout
(
function
(){
console
.
debug
(
"
===============Ans_GetAllActive_0300 setTimeout==================>
"
);
done
();
},
time
);
})
/*
* @tc.number: Ans_GetAllActive_xts_0400
* @tc.name: getAllActiveNotifications(): Promise<Array<NotificationRequest>>;
* @tc.desc: Verify: after publishing two notifications,
cancel one of the notifications, get all active notifications info(promise)
*/
it
(
'
Ans_GetAllActive_xts_0400
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
===============Ans_GetAllActive_0400 start==================>
"
);
await
notify
.
cancelAll
();
var
notificationRequestOfOtherApp
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title_otherApp
"
,
text
:
"
test_text_otherApp
"
,
additionalText
:
"
test_additionalText_otherApp
"
},
},
id
:
2
,
label
:
"
otherApp
"
,
}
await
notify
.
publish
(
notificationRequestOfOtherApp
);
console
.
debug
(
"
===============Ans_GetAllActive_0400 publish OtherApp notify end==================>
"
);
var
notificationRequestOfCurrentApp
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title_currentApp
"
,
text
:
"
test_text_currentApp
"
,
additionalText
:
"
test_additionalText_currentApp
"
},
},
id
:
1
,
label
:
"
currentApp_0400
"
,
}
await
notify
.
publish
(
notificationRequestOfCurrentApp
);
console
.
debug
(
"
===============Ans_GetAllActive_0400 publish CurrentApp notify end==================>
"
);
await
notify
.
cancel
(
1
,
"
currentApp_0400
"
);
console
.
debug
(
"
===============Ans_GetAllActive_0400 cancel end==================>
"
);
var
promiseData
=
await
notify
.
getAllActiveNotifications
();
var
i
;
for
(
i
=
0
;
i
<
promiseData
.
length
;
i
++
)
{
expect
(
promiseData
[
i
].
content
.
normal
.
title
).
assertEqual
(
"
test_title_otherApp
"
);
console
.
log
(
"
=======Ans_GetAllActive_0400 title=====>
"
+
promiseData
[
i
].
content
.
normal
.
title
)
expect
(
promiseData
[
i
].
content
.
normal
.
text
).
assertEqual
(
"
test_text_otherApp
"
);
console
.
log
(
"
=======Ans_GetAllActive_0400 text========>
"
+
promiseData
[
i
].
content
.
normal
.
text
)
expect
(
promiseData
[
i
].
content
.
normal
.
additionalText
).
assertEqual
(
"
test_additionalText_otherApp
"
);
console
.
log
(
"
===Ans_GetAllActive_0400 text====>
"
+
promiseData
[
i
].
content
.
normal
.
additionalText
)
expect
(
promiseData
[
i
].
id
).
assertEqual
(
2
);
console
.
log
(
"
============Ans_GetAllActive_0400 id============>
"
+
promiseData
[
i
].
id
)
expect
(
promiseData
[
i
].
label
).
assertEqual
(
"
otherApp
"
);
console
.
log
(
"
============Ans_GetAllActive_0400 label=====>
"
+
promiseData
[
i
].
label
)
}
console
.
debug
(
"
===============Ans_GetAllActive_0400 getAllActiveNotifications end==================>
"
);
setTimeout
(
function
(){
console
.
debug
(
"
===============Ans_GetAllActive_0400 setTimeout==================>
"
);
done
();
},
time
);
})
function
getAllCallbackFive
(
err
,
data
){
console
.
log
(
"
Ans_GetAllActive_0500 getAllCallbackFive data.length============>
"
+
data
.
length
);
console
.
log
(
"
Ans_GetAllActive_0500 getAllCallbackFive data============>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
length
).
assertEqual
(
0
);
}
/*
* @tc.number: Ans_GetAllActive_xts_0500
* @tc.name: getAllActiveNotifications(callback: AsyncCallback<Array<NotificationRequest>>): void;
* @tc.desc: Verify: After the current app and other apps publish two notifications, remove all the notifications
of the system, get all active notifications in the system(callback)
*/
it
(
'
Ans_GetAllActive_xts_0500
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
===============Ans_GetAllActive_0500 start==================>
"
);
await
notify
.
cancelAll
();
var
notificationRequestOfOtherApp
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title_otherApp
"
,
text
:
"
test_text_otherApp
"
,
additionalText
:
"
test_additionalText_otherApp
"
},
},
id
:
2
,
label
:
"
otherApp
"
,
}
await
notify
.
publish
(
notificationRequestOfOtherApp
);
console
.
debug
(
"
===============Ans_GetAllActive_0500 publish OtherApp notify end==================>
"
);
var
notificationRequestOfCurrentApp
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title_currentApp
"
,
text
:
"
test_text_currentApp
"
,
additionalText
:
"
test_additionalText_currentApp
"
},
},
id
:
1
,
label
:
"
currentApp_0500
"
,
}
await
notify
.
publish
(
notificationRequestOfCurrentApp
);
console
.
debug
(
"
===============Ans_GetAllActive_0500 publish CurrentApp notify end==================>
"
);
await
notify
.
removeAll
();
notify
.
getAllActiveNotifications
(
getAllCallbackFive
);
console
.
debug
(
"
===============Ans_GetAllActive_0500 getAllActiveNotifications end==================>
"
);
setTimeout
(
function
(){
console
.
debug
(
"
===============Ans_GetAllActive_0500 setTimeout==================>
"
);
done
();
},
time
);
})
/*
* @tc.number: Ans_GetAllActive_xts_0600
* @tc.name: getAllActiveNotifications(): Promise<Array<NotificationRequest>>;
* @tc.desc: Verify: After the current app and other apps publish two notifications, remove all the notifications
of the system, get all active notifications in the system(promise)
*/
it
(
'
Ans_GetAllActive_xts_0600
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
===============Ans_GetAllActive_0600 start==================>
"
);
await
notify
.
cancelAll
();
var
notificationRequestOfOtherApp
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title_otherApp
"
,
text
:
"
test_text_otherApp
"
,
additionalText
:
"
test_additionalText_otherApp
"
},
},
id
:
2
,
label
:
"
otherApp
"
,
}
await
notify
.
publish
(
notificationRequestOfOtherApp
);
console
.
debug
(
"
===============Ans_GetAllActive_0600 publish OtherApp notify end==================>
"
);
var
notificationRequestOfCurrentApp
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title_currentApp
"
,
text
:
"
test_text_currentApp
"
,
additionalText
:
"
test_additionalText_currentApp
"
},
},
id
:
1
,
label
:
"
currentApp_0600
"
,
}
await
notify
.
publish
(
notificationRequestOfCurrentApp
);
console
.
debug
(
"
==========Ans_GetAllActive_0600 publish CurrentApp notify end==================>
"
);
await
notify
.
removeAll
();
var
promiseData
=
await
notify
.
getAllActiveNotifications
();
expect
(
promiseData
.
length
).
assertEqual
(
0
);
console
.
debug
(
"
=======Ans_GetAllActive_0600 promiseData.length==========>
"
+
promiseData
.
length
);
console
.
debug
(
"
=======Ans_GetAllActive_0600 promiseData==========>
"
+
JSON
.
stringify
(
promiseData
));
setTimeout
(
function
(){
console
.
debug
(
"
===============Ans_GetAllActive_0600 setTimeout==================>
"
);
done
();
},
time
);
})
function
getAllCallbackSeven
(
err
,
data
){
console
.
log
(
"
Ans_GetAllActive_0700 getAllCallbackSeven data.length============>
"
+
data
.
length
);
console
.
log
(
"
Ans_GetAllActive_0700 getAllCallbackSeven data============>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
length
).
assertEqual
(
0
);
}
/*
* @tc.number: Ans_GetAllActive_xts_0700
* @tc.name: getAllActiveNotifications(callback: AsyncCallback<Array<NotificationRequest>>): void;
* @tc.desc: Verify:No active notifications in the system, get all active notifications in the system(callback)
*/
it
(
'
Ans_GetAllActive_xts_0700
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
===============Ans_GetAllActive_0700 start==================>
"
);
await
notify
.
removeAll
();
notify
.
getAllActiveNotifications
(
getAllCallbackSeven
);
console
.
debug
(
"
===============Ans_GetAllActive_0700 getAllActiveNotifications end==================>
"
);
setTimeout
(
function
(){
console
.
debug
(
"
===============Ans_GetAllActive_0700 setTimeout==================>
"
);
done
();
},
time
);
})
/*
* @tc.number: Ans_GetAllActive_xts_0800
* @tc.name: getAllActiveNotifications(): Promise<Array<NotificationRequest>>;
* @tc.desc: Verify: No active notifications in the system, get all active notifications in the system(promise)
*/
it
(
'
Ans_GetAllActive_xts_0800
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
==========Ans_GetAllActive_0800 start==================>
"
);
await
notify
.
removeAll
();
var
promiseData
=
await
notify
.
getAllActiveNotifications
();
console
.
debug
(
"
=========Ans_GetAllActive_0800 promiseData.length=============>
"
+
promiseData
.
length
);
expect
(
promiseData
.
length
).
assertEqual
(
0
);
setTimeout
(
function
(){
console
.
debug
(
"
===============Ans_GetAllActive_0800 setTimeout==================>
"
);
done
();
},
time
);
})
})
notification/ans_standard/publish_test/actsansgetallactive/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
8ccc5d1b
文件已添加
notification/ans_standard/publish_test/publish/BUILD.gn
0 → 100644
浏览文件 @
8ccc5d1b
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAnsNotificationPublishXts") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsNotificationPublishXts"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
notification/ans_standard/publish_test/publish/Test.json
0 → 100644
浏览文件 @
8ccc5d1b
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"180000"
,
"package"
:
"com.example.actsanspublishtest"
,
"shell-timeout"
:
"60000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsAnsNotificationPublishXts.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
notification/ans_standard/publish_test/publish/entry/.gitignore
0 → 100644
浏览文件 @
8ccc5d1b
/build
notification/ans_standard/publish_test/publish/entry/src/main/config.json
0 → 100644
浏览文件 @
8ccc5d1b
{
"app"
:
{
"bundleName"
:
"com.example.actsanspublishtest"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1
,
"name"
:
"1.0"
},
"apiVersion"
:
{
"compatible"
:
5
,
"target"
:
5
,
"releaseType"
:
"Beta1"
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.example.actsanspublishtest"
,
"name"
:
".MyApplication"
,
"deviceType"
:
[
"phone"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
},
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"name"
:
"com.example.actsanspublishtest.MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
"type"
:
"page"
,
"isVisible"
:
"true"
,
"launchType"
:
"standard"
,
"visible"
:
true
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
notification/ans_standard/publish_test/publish/entry/src/main/js/default/app.js
0 → 100644
浏览文件 @
8ccc5d1b
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export
default
{
onCreate
()
{
console
.
info
(
'
AceApplication onCreate
'
);
},
onDestroy
()
{
console
.
info
(
'
AceApplication onDestroy
'
);
}
};
notification/ans_standard/publish_test/publish/entry/src/main/js/default/i18n/en-US.json
0 → 100644
浏览文件 @
8ccc5d1b
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
}
}
\ No newline at end of file
notification/ans_standard/publish_test/publish/entry/src/main/js/default/i18n/zh-CN.json
0 → 100644
浏览文件 @
8ccc5d1b
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
}
}
\ No newline at end of file
notification/ans_standard/publish_test/publish/entry/src/main/js/default/pages/index/index.css
0 → 100644
浏览文件 @
8ccc5d1b
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
notification/ans_standard/publish_test/publish/entry/src/main/js/default/pages/index/index.hml
0 → 100644
浏览文件 @
8ccc5d1b
<div class="container">
<text class="title">
发布Icon通知
</text>
</div>
notification/ans_standard/publish_test/publish/entry/src/main/js/default/pages/index/index.js
0 → 100644
浏览文件 @
8ccc5d1b
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
file
from
'
@system.file
'
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
const
injectRef
=
Object
.
getPrototypeOf
(
global
)
||
global
injectRef
.
regeneratorRuntime
=
require
(
'
@babel/runtime/regenerator
'
)
export
default
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
console
.
info
(
'
onShow finish
'
)
const
core
=
Core
.
getInstance
()
const
expectExtend
=
new
ExpectExtend
({
'
id
'
:
'
extend
'
})
core
.
addService
(
'
expect
'
,
expectExtend
)
core
.
init
()
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
require
(
'
../../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
console
.
info
(
'
onReady
'
);
},
}
notification/ans_standard/publish_test/publish/entry/src/main/js/resources/base/element/string.json
0 → 100644
浏览文件 @
8ccc5d1b
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"pubIcon"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
notification/ans_standard/publish_test/publish/entry/src/main/js/resources/base/media/icon.png
0 → 100644
浏览文件 @
8ccc5d1b
6.6 KB
notification/ans_standard/publish_test/publish/entry/src/main/js/test/List.test.js
0 → 100644
浏览文件 @
8ccc5d1b
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require
(
'
./publish.js
'
)
\ No newline at end of file
notification/ans_standard/publish_test/publish/entry/src/main/js/test/publish.js
0 → 100644
浏览文件 @
8ccc5d1b
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
notify
from
'
@ohos.notification
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
var
timeout
=
1000
;
describe
(
'
ActsAnsNotificationPublishXts
'
,
function
()
{
console
.
info
(
"
===========ActsAnsNotificationPublish start====================>
"
);
function
onConsumeA
(
data
)
{
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0100 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0100 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
label
).
assertEqual
(
"
ACTS_PublishMULTILINEContent_0100
"
);
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0100 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishMULTILINEContent_xts_0100
* @tc.name: function publish(request: NotificationRequest, callback: AsyncCallback<void>): void;
* @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_MULTILINE)
*/
it
(
'
ACTS_PublishMULTILINEContent_xts_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0100 start===>
"
);
var
subscriber
=
{
onConsume
:
onConsumeA
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===========ACTS_PublishMULTILINEContent_0100 subscribe promise=======>
"
);
var
notificationRequest
=
{
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_MULTILINE
,
multiLine
:
{
title
:
"
test1_title
"
,
text
:
"
test1_text
"
,
additionalText
:
"
test1_additionalText
"
,
briefText
:
"
briefText1
"
,
longTitle
:
"
longTitle1
"
,
lines
:
[
"
thrive
"
,
"
democracy
"
,
"
civilization
"
,
"
harmonious
"
]
},
},
id
:
1
,
slotType
:
notify
.
SlotType
.
OTHER_TYPES
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishMULTILINEContent_0100
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
await
notify
.
publish
(
notificationRequest
,(
err
)
=>
{
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0100 err===>
"
+
err
.
code
);
});
setTimeout
((
async
function
(){
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0100 setTimeout===>
"
);
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0100 setTimeout unsubscribe===>
"
);
done
();
}),
timeout
);
})
function
onConsumeB
(
data
)
{
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0200 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0200 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0200 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishMULTILINEContent_xts_0200
* @tc.name: function publish(request: NotificationRequest, callback: AsyncCallback<void>): void;
* @tc.desc: verify the function of publish()
*/
it
(
'
ACTS_PublishMULTILINEContent_xts_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0200 start===>
"
);
var
subscriber
=
{
onConsume
:
onConsumeB
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0200 subscribe promise===>
"
);
var
notificationRequest
=
{
content
:{
// contentType: notify.ContentType.NOTIFICATION_CONTENT_MULTILINE,
multiLine
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
,
briefText
:
"
briefText
"
,
longTitle
:
"
longTitle
"
,
lines
:
[
"
thrive
"
,
"
democracy
"
,
"
civilization
"
,
"
harmonious
"
]
},
},
id
:
2
,
slotType
:
notify
.
SlotType
.
OTHER_TYPES
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishMULTILINEContent_0200
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
try
{
await
notify
.
publish
(
notificationRequest
,
(
err
)
=>
{
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0200 err===>
"
+
err
.
code
);
});
}
catch
(
err
){
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0200 err===>
"
+
err
.
code
);
}
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0200 setTimeout unsubscribe end===>
"
);
done
();
}),
timeout
);
})
function
onConsumeC
(
data
)
{
console
.
info
(
"
===ANS_Publish_0300 onConsume start===>
"
);
console
.
info
(
"
===ANS_Publish_0300 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
===ANS_Publish_0300 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishMULTILINEContent_xts_0300
* @tc.name: function publish(request: NotificationRequest, callback: AsyncCallback<void>): void;
* @tc.desc: verify the function of publish()
*/
it
(
'
ACTS_PublishMULTILINEContent_xts_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishMULTILINEContent_0300 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeC
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===============ACTS_PublishMULTILINEContent_0300 subscribe promise===============>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_PICTURE
,
multiLine
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
,
briefText
:
"
briefText
"
,
longTitle
:
"
longTitle
"
,
lines
:
[
"
thrive
"
,
"
democracy
"
,
"
civilization
"
,
"
harmonious
"
]
},
},
id
:
3
,
slotType
:
notify
.
SlotType
.
OTHER_TYPES
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishMULTILINEContent_0300
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
try
{
await
notify
.
publish
(
notificationRequest
,
(
err
)
=>
{
console
.
info
(
"
==========ACTS_PublishMULTILINEContent_0300 err==================>
"
+
err
.
code
);
});
}
catch
(
err
){
console
.
info
(
"
==========ACTS_PublishMULTILINEContent_0300 err==================>
"
+
err
.
code
);
}
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishMULTILINEContent_0300 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeD
(
data
)
{
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0400 onConsume===>
"
);
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0400 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
label
).
assertEqual
(
"
ACTS_PublishMULTILINEContent_0400
"
);
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0400 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishMULTILINEContent_xts_0400
* @tc.name: function publish(request: NotificationRequest): Promise<void>;
* @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_MULTILINE) promise
*/
it
(
'
ACTS_PublishMULTILINEContent_xts_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishMULTILINEContent_0400 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeD
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
================ACTS_PublishMULTILINEContent_0400 subscribe promise=============>
"
);
var
notificationRequest
=
{
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_MULTILINE
,
multiLine
:
{
title
:
"
test4_title
"
,
text
:
"
test4_text
"
,
additionalText
:
"
test4_additionalText
"
,
briefText
:
"
briefText4
"
,
longTitle
:
"
longTitle4
"
,
lines
:
[
"
thrive
"
,
"
democracy
"
,
"
civilization
"
,
"
harmonious
"
]
},
},
id
:
4
,
slotType
:
notify
.
SlotType
.
OTHER_TYPES
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishMULTILINEContent_0400
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
notify
.
publish
(
notificationRequest
).
then
(
console
.
info
(
"
======ACTS_PublishMULTILINEContent_0400 promise==================>
"
));
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishMULTILINEContent_0400 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeE
(
data
)
{
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0500 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0500 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0500 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishMULTILINEContent_xts_0500
* @tc.name: function publish(request: NotificationRequest): Promise<void>;
* @tc.desc: function publish(request: NotificationRequest): Promise<void>;
*/
it
(
'
ACTS_PublishMULTILINEContent_xts_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
============ACTS_PublishMULTILINEContent_0500 start==================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeE
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
============ACTS_PublishMULTILINEContent_0500 subscribe promise======>
"
);
var
notificationRequest
=
{
content
:
{
// contentType: notify.ContentType.NOTIFICATION_CONTENT_MULTILINE,
multiLine
:
{
title
:
"
test5_title
"
,
text
:
"
test5_text
"
,
additionalText
:
"
test5_additionalText
"
,
briefText
:
"
briefText5
"
,
longTitle
:
"
longTitle5
"
,
lines
:
[
"
thrive
"
,
"
democracy
"
,
"
civilization
"
,
"
harmonious
"
]
},
},
id
:
5
,
slotType
:
notify
.
SlotType
.
OTHER_TYPES
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishMULTILINEContent_0500
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
try
{
await
notify
.
publish
(
notificationRequest
)
}
catch
(
err
){
console
.
info
(
"
======ACTS_PublishMULTILINEContent_0500 err==================>
"
+
err
.
code
);
}
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishMULTILINEContent_0500 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeF
(
data
)
{
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0600 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0600 onConsume data===>
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
===ACTS_PublishMULTILINEContent_0600 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishMULTILINEContent_xts_0600
* @tc.name: cancelAll(): Promise<void>;
* @tc.desc: Verify that all notifications are cancelled successfully by calling the
cancelAll(): Promise<void> interface, and then cancel the notification again
*/
it
(
'
ACTS_PublishMULTILINEContent_xts_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishMULTILINEContent_0600 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeF
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
==================ACTS_PublishMULTILINEContent_0600 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_PICTURE
,
multiLine
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
,
briefText
:
"
briefText
"
,
longTitle
:
"
longTitle
"
,
lines
:
[
"
thrive
"
,
"
democracy
"
,
"
civilization
"
,
"
harmonious
"
]
},
},
id
:
6
,
slotType
:
notify
.
SlotType
.
OTHER_TYPES
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishMULTILINEContent_0600
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
try
{
await
notify
.
publish
(
notificationRequest
);
}
catch
(
err
){
console
.
info
(
"
==================ACTS_PublishMULTILINEContent_0600 err==================>
"
+
err
.
code
);
}
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishMULTILINEContent_0600 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeG
(
data
)
{
console
.
info
(
"
===ACTS_PublishLONGContent_0100 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishLONGContent_0100 onConsume data: ===>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
label
).
assertEqual
(
"
ACTS_PublishLONGContent_0100
"
);
console
.
info
(
"
===ACTS_PublishLONGContent_0100 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishLONGContent_xts_0100
* @tc.name: function publish(request: NotificationRequest, callback: AsyncCallback<void>): void;
* @tc.desc: function publish(request: NotificationRequest, callback: AsyncCallback<void>): void;
*/
it
(
'
ACTS_PublishLONGContent_xts_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishLONGContent_0100 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeG
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
========ACTS_PublishLONGContent_0100 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_LONG_TEXT
,
longText
:
{
title
:
"
test7_title
"
,
text
:
"
test7_text
"
,
additionalText
:
"
test7_additionalText
"
,
longText
:
"
longText7
"
,
briefText
:
"
briefText7
"
,
expandedTitle
:
"
expandedTitle7
"
},
},
id
:
7
,
slotType
:
notify
.
SlotType
.
OTHER_TYPES
,
isOngoing
:
true
,
isUnremovable
:
true
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishLONGContent_0100
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
await
notify
.
publish
(
notificationRequest
,(
err
)
=>
{
console
.
info
(
"
===========ACTS_PublishLONGContent_0100 err==================>
"
+
err
.
code
);
});
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishLONGContent_0100 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeH
(
data
)
{
console
.
info
(
"
===ACTS_PublishLONGContent_0200 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishLONGContent_0200 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
===ACTS_PublishLONGContent_0200 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishLONGContent_xts_0200
* @tc.name: function publish(request: NotificationRequest, callback: AsyncCallback<void>): void;
* @tc.desc: function publish(request: NotificationRequest, callback: AsyncCallback<void>): void;
*/
it
(
'
ACTS_PublishLONGContent_xts_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishLONGContent_0200 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeH
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
==================ACTS_PublishLONGContent_0200 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
// contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT,
longText
:
{
title
:
"
test8_title
"
,
text
:
"
test8_text
"
,
additionalText
:
"
test8_additionalText
"
,
longText
:
"
longText8
"
,
briefText
:
"
briefText8
"
,
expandedTitle
:
"
expandedTitle8
"
},
},
id
:
8
,
slotType
:
notify
.
SlotType
.
OTHER_TYPES
,
isOngoing
:
true
,
isUnremovable
:
true
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishLONGContent_0200
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
try
{
await
notify
.
publish
(
notificationRequest
,(
err
)
=>
{
console
.
info
(
"
=========ACTS_PublishLONGContent_0200 err==================>
"
+
err
.
code
);
});
}
catch
(
err
){
console
.
info
(
"
=========ACTS_PublishLONGContent_0200 err==================>
"
+
err
.
code
);
}
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishLONGContent_0200 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeI
(
data
)
{
console
.
info
(
"
===ACTS_PublishLONGContent_0300 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishLONGContent_0300 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
===ACTS_PublishLONGContent_0300 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishLONGContent_xts_0300
* @tc.name: function publish(request: NotificationRequest, callback: AsyncCallback<void>): void;
* @tc.desc: function publish(request: NotificationRequest, callback: AsyncCallback<void>): void;
*/
it
(
'
ACTS_PublishLONGContent_xts_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishLONGContent_0300 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeI
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
==================ACTS_PublishLONGContent_0300 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_MEDIA
,
longText
:
{
title
:
"
test9_title
"
,
text
:
"
test9_text
"
,
additionalText
:
"
test9_additionalText
"
,
longText
:
"
longText9
"
,
briefText
:
"
briefText9
"
,
expandedTitle
:
"
expandedTitle9
"
},
},
id
:
9
,
slotType
:
notify
.
SlotType
.
OTHER_TYPES
,
isOngoing
:
true
,
isUnremovable
:
true
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishLONGContent_0300
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
try
{
await
notify
.
publish
(
notificationRequest
,(
err
)
=>
{
console
.
info
(
"
==================ACTS_PublishLONGContent_0300 err==================>
"
+
err
.
code
);
});
}
catch
(
err
){
console
.
info
(
"
==================ACTS_PublishLONGContent_0300 err==================>
"
+
err
.
code
);
}
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishLONGContent_0300 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeJ
(
data
)
{
console
.
info
(
"
===ACTS_PublishLONGContent_0400 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishLONGContent_0400 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
label
).
assertEqual
(
"
ACTS_PublishLONGContent_0400
"
);
console
.
info
(
"
===ACTS_PublishLONGContent_0400 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishLONGContent_xts_0400
* @tc.name: cancel(id: number, callback: AsyncCallback<void>): void;
* @tc.desc: Verify that when the cancel(id: number, callback: AsyncCallback<void>): void
interface is called, when the id is wrong, no notification information is cancelled at this time
*/
it
(
'
ACTS_PublishLONGContent_xts_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishLONGContent_0400 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeJ
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
================ACTS_PublishLONGContent_0400 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_LONG_TEXT
,
longText
:
{
title
:
"
test10_title
"
,
text
:
"
test10_text
"
,
additionalText
:
"
test10_additionalText
"
,
longText
:
"
longText10
"
,
briefText
:
"
briefText10
"
,
expandedTitle
:
"
expandedTitle10
"
},
},
id
:
10
,
slotType
:
notify
.
SlotType
.
OTHER_TYPES
,
isOngoing
:
true
,
isUnremovable
:
true
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishLONGContent_0400
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
await
notify
.
publish
(
notificationRequest
);
console
.
info
(
"
===========ACTS_PublishLONGContent_0400 publish promise==================>
"
);
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishLONGContent_0400 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeK
(
data
)
{
console
.
info
(
"
===ACTS_PublishLONGContent_0500 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishLONGContent_0500 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
===ACTS_PublishLONGContent_0500 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishLONGContent_xts_0500
* @tc.name: cancel(id: number, callback: AsyncCallback<void>): void;
* @tc.desc: Verify the success of canceling the notification with the notification attribute isUnremovable
being true by calling the cancel(id: number, callback: AsyncCallback<void>): void interface
*/
it
(
'
ACTS_PublishLONGContent_xts_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishLONGContent_0500 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeK
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===============ACTS_PublishLONGContent_0500 subscribe promise=============>
"
);
var
notificationRequest
=
{
content
:{
// contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT,
longText
:
{
title
:
"
test11_title
"
,
text
:
"
test11_text
"
,
additionalText
:
"
test11_additionalText
"
,
longText
:
"
longText11
"
,
briefText
:
"
briefText11
"
,
expandedTitle
:
"
expandedTitle11
"
},
},
id
:
11
,
slotType
:
notify
.
SlotType
.
OTHER_TYPES
,
isOngoing
:
true
,
isUnremovable
:
true
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishLONGContent_0500
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
try
{
await
notify
.
publish
(
notificationRequest
);
}
catch
(
err
){
console
.
info
(
"
============ACTS_PublishLONGContent_0500 err===========>
"
+
err
.
code
);
}
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishLONGContent_0500 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeL
(
data
)
{
console
.
info
(
"
===ACTS_PublishLONGContent_0600 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishLONGContent_0600 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
===ACTS_PublishLONGContent_0600 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishLONGContent_xts_0600
* @tc.name: cancel(id: number, callback: AsyncCallback<void>): void;
* @tc.desc: Verify that the cancel(id: number, callback: AsyncCallback<void>): void
interface is called twice in a row to cancel the notification
*/
it
(
'
ACTS_PublishLONGContent_xts_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
=============ACTS_PublishLONGContent_0600 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeL
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
=============ACTS_PublishLONGContent_0600 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_MEDIA
,
longText
:
{
title
:
"
test12_title
"
,
text
:
"
test12_text
"
,
additionalText
:
"
test12_additionalText
"
,
longText
:
"
longText12
"
,
briefText
:
"
briefText12
"
,
expandedTitle
:
"
expandedTitle12
"
},
},
id
:
12
,
slotType
:
notify
.
SlotType
.
OTHER_TYPES
,
isOngoing
:
true
,
isUnremovable
:
true
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishLONGContent_0600
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
try
{
await
notify
.
publish
(
notificationRequest
);
}
catch
(
err
){
console
.
info
(
"
========ACTS_PublishLONGContent_0600 err=================>
"
+
err
.
code
);
}
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishLONGContent_0600 setTimeout unsubscribe end==================>
"
);
done
();
}),
1500
);
})
function
onConsumeM
(
data
)
{
console
.
info
(
"
===ANS_Cancel_1300 onConsume start===>
"
);
console
.
info
(
"
===ANS_Cancel_1300 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
label
).
assertEqual
(
"
ACTS_Publish_SlotTypeContent_0100
"
);
console
.
info
(
"
===ANS_Cancel_1300 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_Publish_SlotTypeContent_xts_0100
* @tc.name: cancel(id: number, label: string, callback: AsyncCallback<void>): void;
* @tc.desc: Verify that the cancel notification is successful by calling the
cancel(id: number, label: string, callback: AsyncCallback<void>): void; interface
*/
it
(
'
ACTS_Publish_SlotTypeContent_xts_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0100 start===>
"
);
var
subscriber
=
{
onConsume
:
onConsumeM
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0100 subscribe promise===>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
id
:
13
,
slotType
:
notify
.
SlotType
.
CONTENT_INFORMATION
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_Publish_SlotTypeContent_0100
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
await
notify
.
publish
(
notificationRequest
,(
err
)
=>
{
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0100 err===>
"
+
err
.
code
);
});
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0100 setTimeout unsubscribe end===>
"
);
done
();
}),
timeout
);
})
function
onConsumeN
(
data
)
{
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0200 onConsume start===>
"
);
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0200 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0200 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_Publish_SlotTypeContent_xts_0200
* @tc.name: cancel(id: number, label?: string): Promise<void>
* @tc.desc: Verify that the cancel notification is successful by calling the
cancel(id: number, label?: string): Promise<void> interface
*/
it
(
'
ACTS_Publish_SlotTypeContent_xts_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_Publish_SlotTypeContent_0200 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeN
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
==========ACTS_Publish_SlotTypeContent_0200 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
// contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
id
:
14
,
slotType
:
notify
.
SlotType
.
OTHER_TYPES
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_Publish_SlotTypeContent_0200
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
try
{
await
notify
.
publish
(
notificationRequest
,(
err
)
=>
{
console
.
info
(
"
===============ACTS_Publish_SlotTypeContent_0200 err==============>
"
+
err
.
code
);
});
}
catch
(
err
){
console
.
info
(
"
===============ACTS_Publish_SlotTypeContent_0200 err==============>
"
+
err
.
code
);
}
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_Publish_SlotTypeContent_0200 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeO
(
data
)
{
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0300 onConsume start===>
"
);
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0300 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0300 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_Publish_SlotTypeContent_xts_0300
* @tc.name: cancel(id: number, label: string, callback: AsyncCallback<void>): void
* @tc.desc: Verify that the notification whose notification property isUnremovable is true is canceled
successfully by calling the cancel(id: number, label: string, callback: AsyncCallback<void>): void interface
*/
it
(
'
ACTS_Publish_SlotTypeContent_xts_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_Publish_SlotTypeContent_0300 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeO
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
=======ACTS_Publish_SlotTypeContent_0300 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
id
:
15
,
isOngoing
:
true
,
isUnremovable
:
true
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_Publish_SlotTypeContent_0300
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
await
notify
.
publish
(
notificationRequest
,(
err
)
=>
{
console
.
info
(
"
===========ACTS_Publish_SlotTypeContent_0300 publish promise=============>
"
+
err
.
code
);
});
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_Publish_SlotTypeContent_0300 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeP
(
data
)
{
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0400 onConsume start===>
"
);
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0400 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
label
).
assertEqual
(
"
ACTS_Publish_SlotTypeContent_0400
"
);
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0400 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_Publish_SlotTypeContent_xts_0400
* @tc.name: cancel(id: number, label?: string): Promise<void>
* @tc.desc: Verify that the notification whose notification property isUnremovable is true
is canceled successfully by calling the cancel(id: number, label?: string): Promise<void> interface
*/
it
(
'
ACTS_Publish_SlotTypeContent_xts_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0400 start===>
"
);
var
subscriber
=
{
onConsume
:
onConsumeP
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0400 subscribe promise===>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
id
:
16
,
slotType
:
notify
.
SlotType
.
SERVICE_INFORMATION
,
isOngoing
:
true
,
isUnremovable
:
true
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_Publish_SlotTypeContent_0400
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
await
notify
.
publish
(
notificationRequest
,(
err
)
=>
{
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0400 err===>
"
+
err
.
code
);
});
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0400 setTimeout unsubscribe end===>
"
);
done
();
}),
timeout
);
})
function
onConsumeQ
(
data
)
{
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0500 onConsume start===>
"
);
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0500 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
label
).
assertEqual
(
"
ACTS_Publish_SlotTypeContent_0500
"
);
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0500 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_Publish_SlotTypeContent_xts_0500
* @tc.name: cancel(id: number, label: string, callback: AsyncCallback<void>): void;
* @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback<void>): void
interface is called, the label is wrong and the ID is correct.
*/
it
(
'
ACTS_Publish_SlotTypeContent_xts_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_Publish_SlotTypeContent_0500 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeQ
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
==============ACTS_Publish_SlotTypeContent_0500 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
id
:
17
,
slotType
:
notify
.
SlotType
.
CONTENT_INFORMATION
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_Publish_SlotTypeContent_0500
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
await
notify
.
publish
(
notificationRequest
);
console
.
info
(
"
==============ACTS_Publish_SlotTypeContent_0500 publish promise==================>
"
);
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_Publish_SlotTypeContent_0500 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeR
(
data
)
{
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0600 onConsume start===>
"
);
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0600 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0600 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_Publish_SlotTypeContent_xts_0600
* @tc.name: cancel(id: number, label?: string): Promise<void>
* @tc.desc: Verify that the cancel(id: number, label?: string): Promise<void> interface is called,
the label is wrong and the ID is correct.
*/
it
(
'
ACTS_Publish_SlotTypeContent_xts_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_Publish_SlotTypeContent_0600 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeR
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
==============ACTS_Publish_SlotTypeContent_0600 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
// contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
id
:
18
,
slotType
:
notify
.
SlotType
.
CONTENT_INFORMATION
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_Publish_SlotTypeContent_0600
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
try
{
await
notify
.
publish
(
notificationRequest
);
}
catch
(
err
){
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0600 publish promise===>
"
+
err
.
code
);
}
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_Publish_SlotTypeContent_0600 setTimeout unsubscribe end===>
"
);
done
();
}),
timeout
);
})
function
onConsumeS
(
data
)
{
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0700 onConsume start===>
"
);
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0700 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
label
).
assertEqual
(
"
ACTS_Publish_SlotTypeContent_0700
"
);
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0700 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_Publish_SlotTypeContent_xts_0700
* @tc.name: cancel(id: number, label: string, callback: AsyncCallback<void>): void;
* @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback<void>): void
interface is called, and the label uses empty characters
*/
it
(
'
ACTS_Publish_SlotTypeContent_xts_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_Publish_SlotTypeContent_0700 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeS
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
=============ACTS_Publish_SlotTypeContent_0700 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
id
:
19
,
// slotType : notify.SlotType.CONTENT_INFORMATION,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_Publish_SlotTypeContent_0700
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
await
notify
.
publish
(
notificationRequest
);
console
.
info
(
"
==========ACTS_Publish_SlotTypeContent_0700 publish promise==============>
"
);
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_Publish_SlotTypeContent_0700 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeT
(
data
)
{
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0800 onConsume start===>
"
);
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0800 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
label
).
assertEqual
(
"
ACTS_Publish_SlotTypeContent_0800
"
);
console
.
info
(
"
===ACTS_Publish_SlotTypeContent_0800 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_Publish_SlotTypeContent_xts_0800
* @tc.name: cancel(id: number, label?: string): Promise<void>;
* @tc.desc: Verify that the cancel(id: number, label?: string): Promise<void> interface is called,
and the label uses empty characters
*/
it
(
'
ACTS_Publish_SlotTypeContent_xts_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_Publish_SlotTypeContent_0800 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeT
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
=========ACTS_Publish_SlotTypeContent_0800 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
id
:
20
,
slotType
:
notify
.
SlotType
.
SERVICE_INFORMATION
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_Publish_SlotTypeContent_0800
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
await
notify
.
publish
(
notificationRequest
);
console
.
info
(
"
============ACTS_Publish_SlotTypeContent_0800 publish promise===============>
"
);
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_Publish_SlotTypeContent_0800 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeU
(
data
)
{
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0100 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0100 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
label
).
assertEqual
(
"
ACTS_PublishSlotTypeOther_0100
"
);
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0100 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeOther_xts_0100
* @tc.name: cancel(id: number, label: string, callback: AsyncCallback<void>): void;
* @tc.desc: Verify that the cancel notification is successful by calling the
cancel(id: number, label: string, callback: AsyncCallback<void>): void; interface
*/
it
(
'
ACTS_PublishSlotTypeOther_xts_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0100 start===>
"
);
var
subscriber
=
{
onConsume
:
onConsumeU
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0100 subscribe promise===>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
id
:
13
,
slotType
:
notify
.
SlotType
.
OTHER_TYPES
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishSlotTypeOther_0100
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
await
notify
.
publish
(
notificationRequest
,(
err
)
=>
{
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0100 err===>
"
+
err
.
code
);
});
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0100 setTimeout unsubscribe end===>
"
);
done
();
}),
timeout
);
})
function
onConsumeV
(
data
)
{
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0200 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0200 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0200 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeOther_xts_0200
* @tc.name: cancel(id: number, label?: string): Promise<void>
* @tc.desc: Verify that the cancel notification is successful by calling the
cancel(id: number, label?: string): Promise<void> interface
*/
it
(
'
ACTS_PublishSlotTypeOther_xts_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeOther_0200 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeV
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
==========ACTS_PublishSlotTypeOther_0200 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
// contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
id
:
14
,
slotType
:
notify
.
SlotType
.
OTHER_TYPES
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishSlotTypeOther_0200
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
try
{
await
notify
.
publish
(
notificationRequest
,(
err
)
=>
{
console
.
info
(
"
===============ACTS_PublishSlotTypeOther_0200 err==============>
"
+
err
.
code
);
});
}
catch
(
err
){
console
.
info
(
"
===============ACTS_PublishSlotTypeOther_0200 err==============>
"
+
err
.
code
);
}
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeOther_0200 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeW
(
data
)
{
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0300 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0300 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0300 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeOther_xts_0300
* @tc.name: cancel(id: number, label: string, callback: AsyncCallback<void>): void
* @tc.desc: Verify that the notification whose notification property isUnremovable is true is canceled
successfully by calling the cancel(id: number, label: string, callback: AsyncCallback<void>): void interface
*/
it
(
'
ACTS_PublishSlotTypeOther_xts_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeOther_0300 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeW
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
=======ACTS_PublishSlotTypeOther_0300 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
id
:
15
,
isOngoing
:
true
,
isUnremovable
:
true
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishSlotTypeOther_0300
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
await
notify
.
publish
(
notificationRequest
,(
err
)
=>
{
console
.
info
(
"
===========ACTS_PublishSlotTypeOther_0300 err=============>
"
+
err
.
code
);
});
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeOther_0300 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeX
(
data
)
{
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0400 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0400 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
label
).
assertEqual
(
"
ACTS_PublishSlotTypeOther_0400
"
);
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0400 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeOther_xts_0400
* @tc.name: cancel(id: number, label?: string): Promise<void>
* @tc.desc: Verify that the notification whose notification property isUnremovable is true
is canceled successfully by calling the cancel(id: number, label?: string): Promise<void> interface
*/
it
(
'
ACTS_PublishSlotTypeOther_xts_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0400 start===>
"
);
var
subscriber
=
{
onConsume
:
onConsumeX
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0400 subscribe promise===>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
id
:
16
,
slotType
:
notify
.
SlotType
.
SERVICE_INFORMATION
,
isOngoing
:
true
,
isUnremovable
:
true
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishSlotTypeOther_0400
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
await
notify
.
publish
(
notificationRequest
,(
err
)
=>
{
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0400 err===>
"
+
err
.
code
);
});
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0400 setTimeout unsubscribe end===>
"
);
done
();
}),
timeout
);
})
function
onConsumeY
(
data
)
{
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0500 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0500 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
label
).
assertEqual
(
"
ACTS_PublishSlotTypeOther_0500
"
);
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0500 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeOther_xts_0500
* @tc.name: cancel(id: number, label: string, callback: AsyncCallback<void>): void;
* @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback<void>): void
interface is called, the label is wrong and the ID is correct.
*/
it
(
'
ACTS_PublishSlotTypeOther_xts_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeOther_0500 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeY
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
==============ACTS_PublishSlotTypeOther_0500 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
id
:
17
,
slotType
:
notify
.
SlotType
.
CONTENT_INFORMATION
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishSlotTypeOther_0500
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
await
notify
.
publish
(
notificationRequest
);
console
.
info
(
"
==============ACTS_PublishSlotTypeOther_0500 publish promise==================>
"
);
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeOther_0500 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeZ
(
data
)
{
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0600 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0600 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0600 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeOther_xts_0600
* @tc.name: cancel(id: number, label?: string): Promise<void>
* @tc.desc: Verify that the cancel(id: number, label?: string): Promise<void> interface is called,
the label is wrong and the ID is correct.
*/
it
(
'
ACTS_PublishSlotTypeOther_xts_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeOther_0600 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeZ
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
==============ACTS_PublishSlotTypeOther_0600 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
// contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
id
:
18
,
slotType
:
notify
.
SlotType
.
CONTENT_INFORMATION
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishSlotTypeOther_0600
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
try
{
await
notify
.
publish
(
notificationRequest
);
}
catch
(
err
){
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0600 publish promise===>
"
+
err
.
code
);
}
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeOther_0600 setTimeout unsubscribe end===>
"
);
done
();
}),
timeout
);
})
function
onConsumea
(
data
)
{
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0700 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0700 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
label
).
assertEqual
(
"
ACTS_PublishSlotTypeOther_0700
"
);
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0700 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeOther_xts_0700
* @tc.name: cancel(id: number, label: string, callback: AsyncCallback<void>): void;
* @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback<void>): void
interface is called, and the label uses empty characters
*/
it
(
'
ACTS_PublishSlotTypeOther_xts_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeOther_0700 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumea
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
=============ACTS_PublishSlotTypeOther_0700 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
id
:
19
,
// slotType : notify.SlotType.CONTENT_INFORMATION,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishSlotTypeOther_0700
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
await
notify
.
publish
(
notificationRequest
);
console
.
info
(
"
==========ACTS_PublishSlotTypeOther_0700 publish promise==============>
"
);
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeOther_0700 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
onConsumeb
(
data
)
{
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0800 onConsume start===>
"
);
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0800 onConsume data:===>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
label
).
assertEqual
(
"
ACTS_PublishSlotTypeOther_0800
"
);
console
.
info
(
"
===ACTS_PublishSlotTypeOther_0800 onConsume end===>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeOther_xts_0800
* @tc.name: cancel(id: number, label?: string): Promise<void>;
* @tc.desc: Verify that the cancel(id: number, label?: string): Promise<void> interface is called,
and the label uses empty characters
*/
it
(
'
ACTS_PublishSlotTypeOther_xts_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeOther_0800 start==========================>
"
);
var
subscriber
=
{
onConsume
:
onConsumeb
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
=========ACTS_PublishSlotTypeOther_0800 subscribe promise==================>
"
);
var
notificationRequest
=
{
content
:{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
id
:
20
,
slotType
:
notify
.
SlotType
.
SERVICE_INFORMATION
,
isOngoing
:
true
,
isUnremovable
:
false
,
deliveryTime
:
1624950453
,
tapDismissed
:
true
,
autoDeletedTime
:
1625036817
,
color
:
2
,
colorEnabled
:
true
,
isAlertOnce
:
true
,
isStopwatch
:
true
,
isCountDown
:
true
,
progressValue
:
12
,
progressMaxValue
:
100
,
isIndeterminate
:
true
,
statusBarText
:
"
statusBarText
"
,
isFloatingIcon
:
true
,
label
:
"
ACTS_PublishSlotTypeOther_0800
"
,
badgeIconStyle
:
1
,
showDeliveryTime
:
true
,
}
await
notify
.
publish
(
notificationRequest
);
console
.
info
(
"
============ACTS_PublishSlotTypeOther_0800 publish promise===============>
"
);
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeOther_0800 setTimeout unsubscribe end==================>
"
);
done
();
}),
timeout
);
})
function
publishSlotSocialCallback001
(
error
){
console
.
log
(
'
=========ACTS_PublishSlotTypeSocial_0100 publish callback==========>
'
+
JSON
.
stringify
(
error
.
code
));
}
function
onConsume0100
(
data
){
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0100 onConsume start===========>
"
);
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0100 onConsume data:===========>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
content
.
normal
.
title
).
assertEqual
(
"
test37_title
"
);
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0100 onConsume end=============>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeSocial_xts_0100
* @tc.name: publish()
* @tc.desc: verify publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:SOCIAL_COMMUNICATION)
*/
it
(
'
ACTS_PublishSlotTypeSocial_xts_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeSocial_0100================>
"
);
var
subscriber
=
{
onConsume
:
onConsume0100
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===============ACTS_PublishSlotTypeSocial_0100 subscribe======>
"
);
await
notify
.
publish
({
id
:
37
,
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test37_title
"
,
text
:
"
test37_text
"
,
additionalText
:
"
test37_additionalText
"
},
slotType
:
notify
.
SlotType
.
SOCIAL_COMMUNICATION
}
},
publishSlotSocialCallback001
);
console
.
info
(
"
==========ACTS_PublishSlotTypeSocial_0100 publish======>
"
);
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeSocial_0100 setTimeout unsubscribe===>
"
);
done
();
}),
timeout
);
});
function
publishSlotSocialCallback002
(
error
){
console
.
log
(
'
=========ACTS_PublishSlotTypeSocial_0200 publish callback==========>
'
+
JSON
.
stringify
(
error
.
code
));
}
function
onConsume0200
(
data
){
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0200 onConsume start===========>
"
);
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0200 onConsume data:===========>
"
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0200 onConsume end=============>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeSocial_xts_0200
* @tc.name: publish()
* @tc.desc: verify the function of publish(slotType:SOCIAL_COMMUNICATION)
*/
it
(
'
ACTS_PublishSlotTypeSocial_xts_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeSocial_0200================>
"
);
var
subscriber
=
{
onConsume
:
onConsume0200
}
await
notify
.
subscribe
(
subscriber
);
try
{
await
notify
.
publish
({
id
:
38
,
content
:
{
// contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
slotType
:
notify
.
SlotType
.
SOCIAL_COMMUNICATION
}
},
publishSlotSocialCallback002
);
}
catch
(
err
){
console
.
info
(
"
==========ACTS_PublishSlotTypeSocial_0200 publish======>
"
+
err
.
code
);
}
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeSocial_0200 setTimeout unsubscribe===>
"
);
done
();
}),
timeout
);
});
function
publishSlotSocialCallback003
(
error
){
console
.
log
(
'
=========ACTS_PublishSlotTypeSocial_0300 publish callback==========>
'
+
JSON
.
stringify
(
error
.
code
));
}
function
onConsume0300
(
data
){
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0300 onConsume start===========>
"
);
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0300 onConsume data:===========>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
content
.
normal
.
title
).
assertEqual
(
"
test39_title
"
);
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0300 onConsume end=============>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeSocial_xts_0300
* @tc.name: publish()
* @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT)
*/
it
(
'
ACTS_PublishSlotTypeSocial_xts_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeSocial_0300================>
"
);
var
subscriber
=
{
onConsume
:
onConsume0300
}
await
notify
.
subscribe
(
subscriber
);
await
notify
.
publish
({
id
:
39
,
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test39_title
"
,
text
:
"
test39_text
"
,
additionalText
:
"
test39_additionalText
"
},
// slotType:notification.SlotType.SOCIAL_COMMUNICATION
}
},
publishSlotSocialCallback003
);
console
.
info
(
"
==========ACTS_PublishSlotTypeSocial_0300 publish======>
"
);
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeSocial_0300 setTimeout unsubscribe===>
"
);
done
();
}),
timeout
);
});
function
publishSlotSocialCallback004
(
error
){
console
.
log
(
'
=========ACTS_PublishSlotTypeSocial_0400 publish callback==========>
'
+
JSON
.
stringify
(
error
.
code
));
}
function
onConsume0400
(
data
){
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0400 onConsume start===========>
"
);
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0400 onConsume data:===========>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
content
.
normal
.
title
).
assertEqual
(
"
test40_title
"
);
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0400 onConsume end=============>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeSocial_xts_0400
* @tc.name: publish()
* @tc.desc: verify the publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:CONTENT_INFORMATION)
*/
it
(
'
ACTS_PublishSlotTypeSocial_xts_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeSocial_0400================>
"
);
var
subscriber
=
{
onConsume
:
onConsume0400
}
await
notify
.
subscribe
(
subscriber
);
await
notify
.
publish
({
id
:
40
,
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test40_title
"
,
text
:
"
test40_text
"
,
additionalText
:
"
test40_additionalText
"
},
slotType
:
notify
.
SlotType
.
CONTENT_INFORMATION
}
},
publishSlotSocialCallback004
);
console
.
info
(
"
==========ACTS_PublishSlotTypeSocial_0400 publish======>
"
);
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeSocial_0400 setTimeout unsubscribe===>
"
);
done
();
}),
timeout
);
});
function
onConsume0500
(
data
){
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0500 onConsume start===========>
"
);
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0500 onConsume data:===========>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
content
.
normal
.
title
).
assertEqual
(
"
test41_title
"
);
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0500 onConsume end=============>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeSocial_xts_0500
* @tc.name: publish()
* @tc.desc: verify publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:SOCIAL_COMMUNICATION) promise
*/
it
(
'
ACTS_PublishSlotTypeSocial_xts_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeSocial_0500================>
"
);
var
subscriber
=
{
onConsume
:
onConsume0500
}
await
notify
.
subscribe
(
subscriber
);
notify
.
publish
({
id
:
41
,
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test41_title
"
,
text
:
"
test41_text
"
,
additionalText
:
"
test41_additionalText
"
},
slotType
:
notify
.
SlotType
.
SOCIAL_COMMUNICATION
}
}).
then
(
console
.
info
(
"
==========ACTS_PublishSlotTypeSocial_0500 publish then======>
"
));
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeSocial_0500 setTimeout unsubscribe===>
"
);
done
();
}),
timeout
);
});
function
onConsume0600
(
data
){
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0600 onConsume start===========>
"
);
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0600 onConsume data:===========>
"
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0600 onConsume end=============>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeSocial_xts_0600
* @tc.name: publish()
* @tc.desc: verify the function of publish(slotType:SOCIAL_COMMUNICATION) promise
*/
it
(
'
ACTS_PublishSlotTypeSocial_xts_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeSocial_0600================>
"
);
var
subscriber
=
{
onConsume
:
onConsume0600
}
await
notify
.
subscribe
(
subscriber
);
try
{
var
promise
=
notify
.
publish
({
id
:
42
,
content
:
{
// contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
slotType
:
notify
.
SlotType
.
SOCIAL_COMMUNICATION
}
})
}
catch
(
err
){
console
.
info
(
"
======ACTS_PublishSlotTypeSocial_0600 err===>
"
+
err
.
code
);
}
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeSocial_0600 setTimeout unsubscribe===>
"
);
done
();
}),
timeout
);
});
function
onConsume0700
(
data
){
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0700 onConsume start===========>
"
);
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0700 onConsume data:===========>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
content
.
normal
.
title
).
assertEqual
(
"
test43_title
"
);
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0700 onConsume end=============>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeSocial_xts_0700
* @tc.name: publish()
* @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT) promise
*/
it
(
'
ACTS_PublishSlotTypeSocial_xts_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeSocial_0700================>
"
);
var
subscriber
=
{
onConsume
:
onConsume0700
}
await
notify
.
subscribe
(
subscriber
);
var
notificationRequest
=
{
id
:
43
,
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test43_title
"
,
text
:
"
test43_text
"
,
additionalText
:
"
test43_additionalText
"
},
//slotType:notification.SlotType.SOCIAL_COMMUNICATION
}
}
await
notify
.
publish
(
notificationRequest
);
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeSocial_0700 setTimeout unsubscribe===>
"
);
done
();
}),
timeout
)
});
function
onConsume0800
(
data
){
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0800 onConsume start===========>
"
);
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0800 onConsume data:===========>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
content
.
normal
.
title
).
assertEqual
(
"
test44_title
"
);
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0800 onConsume end=============>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeSocial_xts_0800
* @tc.name: publish()
* @tc.desc: verify the publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:CONTENT_INFORMATION) promise
*/
it
(
'
ACTS_PublishSlotTypeSocial_xts_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeSocial_0800================>
"
);
var
subscriber
=
{
onConsume
:
onConsume0800
}
await
notify
.
subscribe
(
subscriber
);
await
notify
.
publish
({
id
:
44
,
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test44_title
"
,
text
:
"
test44_text
"
,
additionalText
:
"
test44_additionalText
"
},
slotType
:
notify
.
SlotType
.
CONTENT_INFORMATION
}
})
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
===============ACTS_PublishSlotTypeSocial_0800 setTimeout unsubscribe================>
"
);
done
();
}),
timeout
)
});
function
publishSlotServiceCallback001
(
error
){
console
.
log
(
'
=========ACTS_PublishSlotTypeSocial_0100 publish callback==========>
'
+
JSON
.
stringify
(
error
.
code
));
}
function
onConsume0900
(
data
){
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0100 onConsume start===========>
"
);
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0100 onConsume data:===========>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
content
.
normal
.
title
).
assertEqual
(
"
test29_title
"
);
console
.
info
(
"
===========ACTS_PublishSlotTypeSocial_0100 onConsume end=============>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeService_xts_0100
* @tc.name: publish()
* @tc.desc: verify the publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:SERVICE_INFORMATION)
*/
it
(
'
ACTS_PublishSlotTypeService_xts_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeService_0100================>
"
);
var
subscriber
=
{
onConsume
:
onConsume0900
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===============ACTS_PublishSlotTypeService_0100 subscribe======>
"
);
await
notify
.
publish
({
id
:
29
,
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test29_title
"
,
text
:
"
test29_text
"
,
additionalText
:
"
test29_additionalText
"
},
},
slotType
:
notify
.
SlotType
.
SERVICE_INFORMATION
},
publishSlotServiceCallback001
);
console
.
info
(
"
==========ACTS_PublishSlotTypeService_0100 publish======>
"
);
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeService_0100 setTimeout unsubscribe===>
"
);
done
();
}),
timeout
);
});
function
publishSlotServiceCallback002
(
error
){
console
.
log
(
'
========ACTS_PublishSlotTypeService_0200 publish callback========>
'
+
JSON
.
stringify
(
error
.
code
));
}
function
onConsume1000
(
data
){
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0200 onConsume start=========>
"
);
console
.
info
(
"
===========ACTS_PublishSlotTypeService_0200 onConsume data:=========>
"
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
console
.
info
(
"
===========ACTS_PublishSlotTypeService_0200 onConsume end===========>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeService_xts_0200
* @tc.name: publish()
* @tc.desc: verify the function of publish(slotType:SERVICE_INFORMATION)
*/
it
(
'
ACTS_PublishSlotTypeService_xts_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeService_0200================>
"
);
var
subscriber
=
{
onConsume
:
onConsume1000
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===============ACTS_PublishSlotTypeService_0200 subscribe======>
"
);
try
{
await
notify
.
publish
({
id
:
30
,
content
:
{
// contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
slotType
:
notify
.
SlotType
.
SERVICE_INFORMATION
},
publishSlotServiceCallback002
);
}
catch
(
err
){
console
.
info
(
"
==========ACTS_PublishSlotTypeService_0200 err======>
"
+
err
.
code
);
}
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeService_0200 setTimeout unsubscribe===>
"
);
done
();
}),
timeout
);
});
function
publishSlotServiceCallback003
(
error
){
console
.
log
(
'
========ACTS_PublishSlotTypeService_0300 publish callback========>
'
+
JSON
.
stringify
(
error
.
code
));
}
function
onConsume1100
(
data
){
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0300 onConsume start=========>
"
);
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0300 onConsume data:=========>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
content
.
normal
.
title
).
assertEqual
(
"
test31_title
"
);
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0300 onConsume end===========>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeService_xts_0300
* @tc.name: publish()
* @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT)
*/
it
(
'
ACTS_PublishSlotTypeService_xts_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeService_0300================>
"
);
var
subscriber
=
{
onConsume
:
onConsume1100
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===============ACTS_PublishSlotTypeService_0300 subscribe======>
"
);
await
notify
.
publish
({
id
:
31
,
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test31_title
"
,
text
:
"
test31_text
"
,
additionalText
:
"
test31_additionalText
"
},
},
// slotType:notification.SlotType.SERVICE_INFORMATION
},
publishSlotServiceCallback003
);
console
.
info
(
"
==========ACTS_PublishSlotTypeService_0300 publish======>
"
);
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeService_0300 setTimeout unsubscribe===>
"
);
done
();
}),
timeout
);
});
function
publishSlotServiceCallback004
(
error
){
console
.
log
(
'
========ACTS_PublishSlotTypeService_0400 publish callback========>
'
+
JSON
.
stringify
(
error
.
code
));
}
function
onConsume1200
(
data
){
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0400 onConsume start=========>
"
);
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0400 onConsume data:=========>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
content
.
normal
.
title
).
assertEqual
(
"
test32_title
"
);
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0400 onConsume end===========>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeService_xts_0400
* @tc.name: publish()
* @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:UNKNOWN_TYPE)
*/
it
(
'
ACTS_PublishSlotTypeService_xts_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeService_0400================>
"
);
var
subscriber
=
{
onConsume
:
onConsume1200
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===============ACTS_PublishSlotTypeService_0400 subscribe======>
"
);
await
notify
.
publish
({
id
:
32
,
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test32_title
"
,
text
:
"
test32_text
"
,
additionalText
:
"
test32_additionalText
"
},
},
slotType
:
notify
.
SlotType
.
UNKNOWN_TYPE
},
publishSlotServiceCallback004
);
console
.
info
(
"
==========ACTS_PublishSlotTypeService_0400 publish======>
"
);
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeService_0400 setTimeout unsubscribe===>
"
);
done
();
}),
timeout
);
});
function
onConsume1300
(
data
){
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0500 onConsume start=========>
"
);
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0500 onConsume data:=========>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
content
.
normal
.
title
).
assertEqual
(
"
test33_title
"
);
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0500 onConsume end===========>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeService_xts_0500
* @tc.name: publish()
* @tc.desc: verify the publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:SERVICE_INFORMATION) promise
*/
it
(
'
ACTS_PublishSlotTypeService_xts_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeService_0500================>
"
);
var
subscriber
=
{
onConsume
:
onConsume1300
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===============ACTS_PublishSlotTypeService_0500 subscribe======>
"
);
notify
.
publish
({
id
:
33
,
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test33_title
"
,
text
:
"
test33_text
"
,
additionalText
:
"
test33_additionalText
"
},
},
slotType
:
notify
.
SlotType
.
SERVICE_INFORMATION
}).
then
(
console
.
log
(
"
==========ACTS_PublishSlotTypeService_0500 publish then======>
"
))
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeService_0500 setTimeout unsubscribe===>
"
);
done
();
}),
timeout
);
});
function
onConsume1400
(
data
){
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0600 onConsume start=========>
"
);
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0600 onConsume data:=========>
"
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0600 onConsume end===========>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeService_xts_0600
* @tc.name: publish()
* @tc.desc: verify the function of publish(slotType:SERVICE_INFORMATION) promise
*/
it
(
'
ACTS_PublishSlotTypeService_xts_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeService_0600================>
"
);
var
subscriber
=
{
onConsume
:
onConsume1400
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===============ACTS_PublishSlotTypeService_0600 subscribe======>
"
);
try
{
var
promise
=
notify
.
publish
({
id
:
34
,
content
:
{
// contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal
:
{
title
:
"
test_title
"
,
text
:
"
test_text
"
,
additionalText
:
"
test_additionalText
"
},
},
slotType
:
notify
.
SlotType
.
SERVICE_INFORMATION
})
}
catch
(
err
){
console
.
info
(
"
======ACTS_PublishSlotTypeService_0600 err===>
"
+
err
.
code
);
}
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeService_0600 setTimeout unsubscribe===>
"
);
done
();
}),
timeout
);
});
function
onConsume1500
(
data
){
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0700 onConsume start=========>
"
);
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0700 onConsume data:=========>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
content
.
normal
.
title
).
assertEqual
(
"
test35_title
"
);
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0700 onConsume end===========>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeService_xts_0700
* @tc.name: publish()
* @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT) promise
*/
it
(
'
ACTS_PublishSlotTypeService_xts_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeService_0700================>
"
);
var
subscriber
=
{
onConsume
:
onConsume1500
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===============ACTS_PublishSlotTypeService_0700 subscribe======>
"
);
notify
.
publish
({
id
:
35
,
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test35_title
"
,
text
:
"
test35_text
"
,
additionalText
:
"
test35_additionalText
"
},
},
// slotType:notification.SlotType.SERVICE_INFORMATION
}).
then
(
console
.
log
(
"
===ACTS_PublishSlotTypeService_0700 finished===
"
));
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeService_0700 setTimeout unsubscribe===>
"
);
done
();
}),
timeout
);
});
function
onConsume1600
(
data
){
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0800 onConsume start=========>
"
);
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0800 onConsume data:=========>
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
request
.
content
.
normal
.
title
).
assertEqual
(
"
test36_title
"
);
console
.
info
(
"
=======ACTS_PublishSlotTypeService_0800 onConsume end===========>
"
);
}
/*
* @tc.number: ACTS_PublishSlotTypeService_xts_0800
* @tc.name: publish()
* @tc.desc: verify publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:UNKNOWN_TYPE) promise
*/
it
(
'
ACTS_PublishSlotTypeService_xts_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ACTS_PublishSlotTypeService_0800================>
"
);
var
subscriber
=
{
onConsume
:
onConsume1600
}
await
notify
.
subscribe
(
subscriber
);
console
.
info
(
"
===============ACTS_PublishSlotTypeService_0800 subscribe======>
"
);
notify
.
publish
({
id
:
36
,
content
:
{
contentType
:
notify
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
normal
:
{
title
:
"
test36_title
"
,
text
:
"
test36_text
"
,
additionalText
:
"
test36_additionalText
"
},
},
slotType
:
notify
.
SlotType
.
UNKNOWN_TYPE
}).
then
(
console
.
log
(
"
===ACTS_PublishSlotTypeService_0800 finished===
"
))
setTimeout
((
async
function
(){
await
notify
.
unsubscribe
(
subscriber
);
console
.
info
(
"
======ACTS_PublishSlotTypeService_0800 setTimeout unsubscribe===>
"
);
done
();
}),
timeout
);
});
})
notification/ans_standard/publish_test/publish/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
8ccc5d1b
文件已添加
notification/ans_standard/publish_test/sub/BUILD.gn
0 → 100644
浏览文件 @
8ccc5d1b
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAnsSubTestXts") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsSubTestXts"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
notification/ans_standard/publish_test/sub/Test.json
0 → 100644
浏览文件 @
8ccc5d1b
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"180000"
,
"package"
:
"com.example.actsanssubtest"
,
"shell-timeout"
:
"60000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsAnsSubTestXts.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
notification/ans_standard/publish_test/sub/entry/.gitignore
0 → 100644
浏览文件 @
8ccc5d1b
/build
notification/ans_standard/publish_test/sub/entry/src/main/config.json
0 → 100644
浏览文件 @
8ccc5d1b
{
"app"
:
{
"bundleName"
:
"com.example.actsanssubtest"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1
,
"name"
:
"1.0"
},
"apiVersion"
:
{
"compatible"
:
5
,
"target"
:
5
,
"releaseType"
:
"Beta1"
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.example.actsanssubtest"
,
"name"
:
".MyApplication"
,
"deviceType"
:
[
"phone"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
},
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"name"
:
"com.example.actsanssubtest.MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
"type"
:
"page"
,
"isVisible"
:
"true"
,
"launchType"
:
"standard"
,
"visible"
:
true
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
notification/ans_standard/publish_test/sub/entry/src/main/js/default/app.js
0 → 100644
浏览文件 @
8ccc5d1b
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export
default
{
onCreate
()
{
console
.
info
(
'
AceApplication onCreate
'
);
},
onDestroy
()
{
console
.
info
(
'
AceApplication onDestroy
'
);
}
};
notification/ans_standard/publish_test/sub/entry/src/main/js/default/i18n/en-US.json
0 → 100644
浏览文件 @
8ccc5d1b
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
}
}
\ No newline at end of file
notification/ans_standard/publish_test/sub/entry/src/main/js/default/i18n/zh-CN.json
0 → 100644
浏览文件 @
8ccc5d1b
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
}
}
\ No newline at end of file
notification/ans_standard/publish_test/sub/entry/src/main/js/default/pages/index/index.css
0 → 100644
浏览文件 @
8ccc5d1b
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
notification/ans_standard/publish_test/sub/entry/src/main/js/default/pages/index/index.hml
0 → 100644
浏览文件 @
8ccc5d1b
<div class="container">
<text class="title">
订阅发布
</text>
</div>
notification/ans_standard/publish_test/sub/entry/src/main/js/default/pages/index/index.js
0 → 100644
浏览文件 @
8ccc5d1b
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
file
from
'
@system.file
'
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
const
injectRef
=
Object
.
getPrototypeOf
(
global
)
||
global
injectRef
.
regeneratorRuntime
=
require
(
'
@babel/runtime/regenerator
'
)
export
default
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
console
.
info
(
'
onShow finish
'
)
const
core
=
Core
.
getInstance
()
const
expectExtend
=
new
ExpectExtend
({
'
id
'
:
'
extend
'
})
core
.
addService
(
'
expect
'
,
expectExtend
)
core
.
init
()
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
require
(
'
../../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
console
.
info
(
'
onReady
'
);
},
}
notification/ans_standard/publish_test/sub/entry/src/main/js/resources/base/element/string.json
0 → 100644
浏览文件 @
8ccc5d1b
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"Subscriber"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
notification/ans_standard/publish_test/sub/entry/src/main/js/resources/base/media/icon.png
0 → 100644
浏览文件 @
8ccc5d1b
6.6 KB
notification/ans_standard/publish_test/sub/entry/src/main/js/test/List.test.js
0 → 100644
浏览文件 @
8ccc5d1b
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require
(
'
./Subscriber.js
'
)
\ No newline at end of file
notification/ans_standard/publish_test/sub/entry/src/main/js/test/Subscriber.js
0 → 100644
浏览文件 @
8ccc5d1b
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
import
notify
from
'
@ohos.notification
'
;
var
timeout
=
1000
;
describe
(
'
ActsAnsSubTestXts
'
,
function
()
{
console
.
info
(
"
==ActsAnsSubscriberTest start==>
"
);
//ActsSubscriber_test_0100
var
subInfoa
=
{
onConnect
:
connectCallbacka
,
onDisconnect
:
disconnectCallbacka
,
}
function
connectCallbacka
()
{
console
.
debug
(
"
==>connectCallbacka code==>
"
);
}
function
subscribeCallbacka
(
err
)
{
console
.
debug
(
"
==>subscribeCallbacka code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
unSubscribeCallbacka
(
err
){
console
.
debug
(
"
==>unSubscribeCallbacka code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
disconnectCallbacka
(){
console
.
debug
(
"
==>disconnectCallbacka code==>
"
);
}
//ActsSubscriber_test_0200
function
connectCallbackb
()
{
console
.
debug
(
"
==>connectCallbackb code==>
"
);
}
function
subscribeCallbackb
(
err
)
{
console
.
debug
(
"
==>subscribeCallbackb code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
subscribeCallbackc
(
err
)
{
console
.
debug
(
"
==>subscribeCallbackc code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
unSubscribeCallbackb
(
err
){
console
.
debug
(
"
==>unSubscribeCallbackb code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
disconnectCallbackb
(){
console
.
debug
(
"
==>disconnectCallbackb code==>
"
);
}
//ActsSubscriber_test_0300
function
connectCallbackc
()
{
console
.
debug
(
"
==>connectCallbackc code==>
"
);
}
function
connectCallbackd
()
{
console
.
debug
(
"
==>connectCallbackd code==>
"
);
}
function
subscribeCallbackd
(
err
)
{
console
.
debug
(
"
==>subscribeCallbackd code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
subscribeCallbacke
(
err
)
{
console
.
debug
(
"
==>subscribeCallbacke code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
unSubscribeCallbackc
(
err
){
console
.
debug
(
"
==>unSubscribeCallbackc code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
unSubscribeCallbackd
(
err
){
console
.
debug
(
"
==>unSubscribeCallbackd code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
disconnectCallbackc
(){
console
.
debug
(
"
==>disconnectCallbackc code==>
"
);
}
function
disconnectCallbackd
(){
console
.
debug
(
"
==>disconnectCallbackd code==>
"
);
}
//ActsSubscriber_test_0400
function
connectCallbackf
()
{
console
.
debug
(
"
==>connectCallbackf code==>
"
);
}
function
connectCallbackg
()
{
console
.
debug
(
"
==>connectCallbackg code==>
"
);
}
function
subscribeCallbackg
(
err
)
{
console
.
debug
(
"
==>subscribeCallbackg code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
subscribeCallbackh
(
err
)
{
console
.
debug
(
"
==>subscribeCallbackh code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
subscribeCallbacki
(
err
)
{
console
.
debug
(
"
==>subscribeCallbacki code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
unSubscribeCallbackf
(
err
){
console
.
debug
(
"
==>unSubscribeCallbackf code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
unSubscribeCallbackg
(
err
){
console
.
debug
(
"
==>unSubscribeCallbackg code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
disconnectCallbackf
(){
console
.
debug
(
"
==>disconnectCallbackf code==>
"
);
}
function
disconnectCallbackg
(){
console
.
debug
(
"
==>disconnectCallbackg code==>
"
);
}
//ActsSubscriber_test_0500
var
subInfob
=
{
onConnect
:
connectCallbacki
,
onDisconnect
:
disconnectCallbacki
,
}
function
connectCallbacki
()
{
console
.
debug
(
"
==>connectCallbacki code==>
"
);
}
function
subscribeCallbackl
(
err
)
{
console
.
debug
(
"
==>subscribeCallbackl code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
unSubscribeCallbacki
(
err
){
console
.
debug
(
"
==>unSubscribeCallbacki code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
disconnectCallbacki
(){
console
.
debug
(
"
==>disconnectCallbacki code==>
"
);
}
//ActsSubscriber_test_0600
var
subInfoc
=
{
onConnecte
:
connectCallbackj
,
onDisconnect
:
disconnectCallbackj
,
}
function
connectCallbackj
()
{
console
.
debug
(
"
==>connectCallbackj code==>
"
);
}
function
unSubscribeCallbackj
(
err
){
console
.
debug
(
"
==>unSubscribeCallbackj code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
disconnectCallbackj
(){
console
.
debug
(
"
==>disconnectCallbackj code==>
"
);
}
//ActsSubscriber_test_0700
var
subInfod
=
{
onConnect
:
connectCallbackm
,
onDisconnect
:
disconnectCallbackl
,
}
function
connectCallbackm
()
{
console
.
debug
(
"
==>connectCallbackm code==>
"
);
}
function
subscribeCallbackn
(
err
)
{
console
.
debug
(
"
==>subscribeCallbackn code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
unSubscribeCallbackl
(
err
){
console
.
debug
(
"
==>unSubscribeCallbackl code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
disconnectCallbackl
(){
console
.
debug
(
"
==>disconnectCallbackl code==>
"
);
}
//ActsSubscriber_test_0800
var
subInfoe
=
{
onConnect
:
connectCallbackn
,
onDisconnect
:
disconnectCallbackm
,
}
function
connectCallbackn
()
{
console
.
debug
(
"
==>connectCallbackn code==>
"
);
}
function
unSubscribeCallbackm
(
err
){
console
.
debug
(
"
==>unSubscribeCallbackm code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
disconnectCallbackm
(){
console
.
debug
(
"
==>disconnectCallbackm code==>
"
);
}
//ActsSubscriber_test_1300
function
connectCallbackl
(){
console
.
debug
(
"
==>connectCallbackl code==>
"
);
}
function
subscribeCallbacko
(
err
){
console
.
debug
(
"
==>subscribeCallbacko code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
unSubscribeCallbackn
(
err
){
console
.
debug
(
"
==>unSubscribeCallbackn code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
disconnectCallbackn
(){
console
.
debug
(
"
==>disconnectCallbackn code==>
"
);
}
//ActsSubscriber_test_1400
function
connectCallbacko
(){
console
.
debug
(
"
==>connectCallbacko code==>
"
);
}
function
subscribeCallbackp
(
err
){
console
.
debug
(
"
==>subscribeCallbackp code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
unSubscribeCallbacko
(
err
){
console
.
debug
(
"
==>unSubscribeCallbacko code==>
"
+
err
.
code
);
expect
(
err
.
code
).
assertEqual
(
0
);
}
function
disconnectCallbacko
(){
console
.
debug
(
"
==>disconnectCallbacko code==>
"
);
}
/*
* @tc.number: ActsSubscriber_test_xts_0100
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it
(
'
ActsSubscriber_test_xts_0100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
==ActsSubscriber_test_0100==begin==>
"
);
await
notify
.
subscribe
(
subInfoa
,
subscribeCallbacka
);
await
notify
.
unsubscribe
(
subInfoa
,
unSubscribeCallbacka
);
console
.
debug
(
"
==ActsSubscriber_test_0100==end==>
"
);
done
();
})
/*
* @tc.number: ActsSubscriber_test_xts_0200
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it
(
'
ActsSubscriber_test_xts_0200
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
==ActsSubscriber_test_0200==begin==>
"
);
var
subInfo
=
{
onConnect
:
connectCallbackb
,
onDisconnect
:
disconnectCallbackb
,
}
await
notify
.
subscribe
(
subInfo
,
subscribeCallbackb
);
await
notify
.
subscribe
(
subInfo
,
subscribeCallbackc
);
await
notify
.
unsubscribe
(
subInfo
,
unSubscribeCallbackb
);
console
.
debug
(
"
==ActsSubscriber_test_0200==end==>
"
);
done
();
})
/*
* @tc.number: ActsSubscriber_test_xts_0300
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it
(
'
ActsSubscriber_test_xts_0300
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
==ActsSubscriber_test_0300==begin==>
"
);
var
subInfo
=
{
onConnect
:
connectCallbackc
,
onDisconnect
:
disconnectCallbackc
,
}
var
subInfo2
=
{
onConnect
:
connectCallbackd
,
onDisconnect
:
disconnectCallbackd
,
}
await
notify
.
subscribe
(
subInfo
,
subscribeCallbackd
);
await
notify
.
subscribe
(
subInfo2
,
subscribeCallbacke
);
await
notify
.
unsubscribe
(
subInfo
,
unSubscribeCallbackc
);
await
notify
.
unsubscribe
(
subInfo2
,
unSubscribeCallbackd
);
console
.
debug
(
"
==ActsSubscriber_test_0300==end==>
"
);
done
();
})
/*
* @tc.number: ActsSubscriber_test_xts_0400
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it
(
'
ActsSubscriber_test_xts_0400
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
==ActsSubscriber_test_0500==begin==>
"
);
var
subInfo
=
{
onConnect
:
connectCallbackf
,
onDisconnect
:
disconnectCallbackf
,
}
var
subInfo2
=
{
onConnect
:
connectCallbackg
,
onDisconnect
:
disconnectCallbackg
,
}
await
notify
.
subscribe
(
subInfo
,
subscribeCallbackg
);
await
notify
.
subscribe
(
subInfo
,
subscribeCallbackh
);
await
notify
.
subscribe
(
subInfo2
,
subscribeCallbacki
);
await
notify
.
unsubscribe
(
subInfo
,
unSubscribeCallbackf
);
await
notify
.
unsubscribe
(
subInfo2
,
unSubscribeCallbackg
);
console
.
debug
(
"
==ActsSubscriber_test_0500==end==>
"
);
done
();
})
/*
* @tc.number: ActsSubscriber_test_xts_0500
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it
(
'
ActsSubscriber_test_xts_0500
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
==ActsSubscriber_test_0500==begin==>
"
);
await
notify
.
subscribe
(
subInfob
,
{
bundleNames
:[
"
com.example.actsanspublishtest
"
]},
subscribeCallbackl
);
await
notify
.
unsubscribe
(
subInfob
,
unSubscribeCallbacki
);
console
.
debug
(
"
==ActsSubscriber_test_0500==end3==>
"
);
done
();
})
/*
* @tc.number: ActsSubscriber_test_xts_0600
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it
(
'
ActsSubscriber_test_xts_0600
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
==ActsSubscriber_test_0600==begin==>
"
);
await
notify
.
subscribe
(
subInfoc
,
{
bundleNames
:[
"
com.example.actsanspublishtest
"
]}).
then
(
async
()
=>
{
console
.
log
(
"
ActsSubscriber_test_0600=======promise
"
)
await
notify
.
unsubscribe
(
subInfoc
,
unSubscribeCallbackj
)
});
console
.
debug
(
"
==ActsSubscriber_test_0600==end==>
"
);
done
();
})
/*
* @tc.number: ActsSubscriber_test_xts_0700
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it
(
'
ActsSubscriber_test_xts_0700
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
==ActsSubscriber_test_0700==begin==>
"
);
await
notify
.
subscribe
(
subInfod
,
{
bundleNames
:[
"
com.example.actsanspublishtest
"
,
"
com.example.actsanspublishtest
"
]},
subscribeCallbackn
);
console
.
debug
(
"
==ActsSubscriber_test_0700==end==>
"
);
await
notify
.
unsubscribe
(
subInfod
,
unSubscribeCallbackl
);
done
();
})
/*
* @tc.number: ActsSubscriber_test_xts_0800
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it
(
'
ActsSubscriber_test_xts_0800
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
==ActsSubscriber_test_0900==begin==>
"
);
await
notify
.
subscribe
(
subInfoe
,
{
bundleNames
:[
"
com.example.actsanspublishtest
"
,
"
com.example.actsanspublishtest
"
]}).
then
(
async
()
=>
{
console
.
log
(
"
ActsSubscriber_test_0900=======promise
"
)
await
notify
.
unsubscribe
(
subInfoe
,
unSubscribeCallbackm
)
});
console
.
debug
(
"
==ActsSubscriber_test_0900==end==>
"
);
done
();
})
/*
* @tc.number: ActsSubscriber_test_xts_0900
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it
(
'
ActsSubscriber_test_xts_0900
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
==ActsSubscriber_test_1000==begin==>
"
);
var
promise
=
notify
.
subscribe
(
100
,{
bundleNames
:[
"
com.example.actsanspublishtest
"
]});
expect
(
promise
).
assertEqual
(
undefined
);
console
.
debug
(
"
==ActsSubscriber_test_1000==end==>
"
);
done
();
})
/*
* @tc.number: ActsSubscriber_test_xts_1000
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it
(
'
ActsSubscriber_test_xts_1000
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
==ActsSubscriber_test_1000==begin==>
"
);
var
subInfo
=
null
var
promise
=
await
notify
.
subscribe
(
subInfo
,{
bundleNames
:[
"
com.example.actsanspublishtest
"
]});
expect
(
promise
).
assertEqual
(
undefined
);
console
.
debug
(
"
==ActsSubscriber_test_1000==end==>
"
);
done
();
})
/*
* @tc.number: ActsSubscriber_test_xts_1100
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it
(
'
ActsSubscriber_test_xts_1100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
==ActsSubscriber_test_1200==begin==>
"
);
var
subInfo
=
"
#$#%$%$^&%^%
"
var
promise
=
notify
.
subscribe
(
subInfo
,{
bundleNames
:[
"
com.example.actsanspublishtest
"
]});
expect
(
promise
).
assertEqual
(
undefined
);
console
.
debug
(
"
==ActsSubscriber_test_1200==end==>
"
);
done
();
})
/*
* @tc.number: ActsSubscriber_test_xts_1200
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it
(
'
ActsSubscriber_test_xts_1200
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
==ActsSubscriber_test_1200==begin==>
"
);
var
subInfo
=
""
var
promise
=
await
notify
.
subscribe
(
subInfo
,{
bundleNames
:[
"
com.example.actsanspublishtest
"
]});
expect
(
promise
).
assertEqual
(
undefined
);
console
.
debug
(
"
==ActsSubscriber_test_1200==end==>
"
);
done
();
})
/*
* @tc.number: ActsSubscriber_test_xts_1300
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it
(
'
ActsSubscriber_test_xts_1300
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
==ActsSubscriber_test_1300==begin==>
"
);
var
subInfo
=
{
onConnect
:
connectCallbackl
,
onDisconnect
:
disconnectCallbackn
,
}
await
notify
.
subscribe
(
subInfo
,{
bundleNames
:[
"
wrongBudleName
"
]},
subscribeCallbacko
);
await
notify
.
unsubscribe
(
subInfo
,
unSubscribeCallbackn
);
console
.
debug
(
"
==ActsSubscriber_test_1300==end==>
"
);
done
();
})
/*
* @tc.number: ActsSubscriber_test_xts_1400
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it
(
'
ActsSubscriber_test_xts_1400
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
==ActsSubscriber_test_1400==begin==>
"
);
var
subInfo
=
{
onConnect
:
connectCallbacko
,
onDisconnect
:
disconnectCallbacko
,
}
try
{
await
notify
.
subscribe
(
subInfo
,
{
bundleNames
:
[]},
subscribeCallbackp
);
}
catch
(
err
){
console
.
debug
(
"
==ActsSubscriber_test_1400==err==>
"
+
err
);
}
console
.
debug
(
"
==ActsSubscriber_test_1400==end==>
"
);
done
();
})
})
notification/ans_standard/publish_test/sub/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
8ccc5d1b
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录