diff --git a/notification/ans_standard/publish_test/BUILD.gn b/notification/ans_standard/publish_test/BUILD.gn
index a2b5047279fe5a88adcc7f99dd062420a23586ed..8e7ccd6f759f77cbf7ea935bb660218b35ebb550 100644
--- a/notification/ans_standard/publish_test/BUILD.gn
+++ b/notification/ans_standard/publish_test/BUILD.gn
@@ -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",
]
diff --git a/notification/ans_standard/publish_test/actsansgetallactive/BUILD.gn b/notification/ans_standard/publish_test/actsansgetallactive/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..93dcb9bdfc828477d3a818b79f4e968882f00a5f
--- /dev/null
+++ b/notification/ans_standard/publish_test/actsansgetallactive/BUILD.gn
@@ -0,0 +1,31 @@
+# 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"
+}
diff --git a/notification/ans_standard/publish_test/actsansgetallactive/Test.json b/notification/ans_standard/publish_test/actsansgetallactive/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..bb7bde6cf6f11401ddd6890167f8ce0643aef2cd
--- /dev/null
+++ b/notification/ans_standard/publish_test/actsansgetallactive/Test.json
@@ -0,0 +1,18 @@
+{
+ "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
+ }
+ ]
+}
diff --git a/notification/ans_standard/publish_test/actsansgetallactive/entry/.gitignore b/notification/ans_standard/publish_test/actsansgetallactive/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..796b96d1c402326528b4ba3c12ee9d92d0e212e9
--- /dev/null
+++ b/notification/ans_standard/publish_test/actsansgetallactive/entry/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/config.json b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..48b47601b60d62145802385e8f172caccf2df164
--- /dev/null
+++ b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/config.json
@@ -0,0 +1,65 @@
+{
+ "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
+ }
+ }
+ ]
+ }
+}
diff --git a/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b
--- /dev/null
+++ b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/app.js
@@ -0,0 +1,22 @@
+/*
+ * 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');
+ }
+};
diff --git a/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
+}
\ No newline at end of file
diff --git a/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..3fdb0466384608079be93abece190eb553f8a31f
--- /dev/null
+++ b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,8 @@
+
+
+ currentApp
+
+
+ ForGetAllActive
+
+
diff --git a/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..c3b6a96287aa8ad4c9bf0e44ccba5d69b68ae02c
--- /dev/null
+++ b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,47 @@
+/*
+ * 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');
+ },
+}
diff --git a/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..0eae115c6686fa5659c552ef37d9e2d01ab02337
--- /dev/null
+++ b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "getAllActive"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/resources/base/media/icon.png b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/resources/base/media/icon.png differ
diff --git a/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..d4125e38523ba8d9be2883ee03581e8e296e6ec9
--- /dev/null
+++ b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/test/List.test.js
@@ -0,0 +1,15 @@
+/*
+ * 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
diff --git a/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/test/getAllActive.js b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/test/getAllActive.js
new file mode 100644
index 0000000000000000000000000000000000000000..515ca1942ffdaca7391d914f317956b9bea61c95
--- /dev/null
+++ b/notification/ans_standard/publish_test/actsansgetallactive/entry/src/main/js/test/getAllActive.js
@@ -0,0 +1,436 @@
+/*
+ * 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>): 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>
+ * @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>): 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>;
+ * @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>): 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>;
+ * @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>): 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>;
+ * @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);
+ })
+})
+
diff --git a/notification/ans_standard/publish_test/actsansgetallactive/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/actsansgetallactive/signature/openharmony_sx.p7b
new file mode 100644
index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6
Binary files /dev/null and b/notification/ans_standard/publish_test/actsansgetallactive/signature/openharmony_sx.p7b differ
diff --git a/notification/ans_standard/publish_test/publish/BUILD.gn b/notification/ans_standard/publish_test/publish/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..d7619cc879ea82692b902615bb40f790a7a13626
--- /dev/null
+++ b/notification/ans_standard/publish_test/publish/BUILD.gn
@@ -0,0 +1,31 @@
+# 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"
+}
diff --git a/notification/ans_standard/publish_test/publish/Test.json b/notification/ans_standard/publish_test/publish/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..a76c85fa5f72cadd231727a4e3b6a2b3907c10a0
--- /dev/null
+++ b/notification/ans_standard/publish_test/publish/Test.json
@@ -0,0 +1,18 @@
+{
+ "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
+ }
+ ]
+}
diff --git a/notification/ans_standard/publish_test/publish/entry/.gitignore b/notification/ans_standard/publish_test/publish/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..796b96d1c402326528b4ba3c12ee9d92d0e212e9
--- /dev/null
+++ b/notification/ans_standard/publish_test/publish/entry/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/notification/ans_standard/publish_test/publish/entry/src/main/config.json b/notification/ans_standard/publish_test/publish/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..afe023398aa275767538102192abb64d9acec11d
--- /dev/null
+++ b/notification/ans_standard/publish_test/publish/entry/src/main/config.json
@@ -0,0 +1,62 @@
+{
+ "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
+ }
+ }
+ ]
+ }
+}
diff --git a/notification/ans_standard/publish_test/publish/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/publish/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b
--- /dev/null
+++ b/notification/ans_standard/publish_test/publish/entry/src/main/js/default/app.js
@@ -0,0 +1,22 @@
+/*
+ * 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');
+ }
+};
diff --git a/notification/ans_standard/publish_test/publish/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/publish/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/notification/ans_standard/publish_test/publish/entry/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
+}
\ No newline at end of file
diff --git a/notification/ans_standard/publish_test/publish/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/publish/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/notification/ans_standard/publish_test/publish/entry/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/notification/ans_standard/publish_test/publish/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/publish/entry/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/notification/ans_standard/publish_test/publish/entry/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/notification/ans_standard/publish_test/publish/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/publish/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..e4de1079abb061603239b0613bc5d38f76a22f87
--- /dev/null
+++ b/notification/ans_standard/publish_test/publish/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ 发布Icon通知
+
+
diff --git a/notification/ans_standard/publish_test/publish/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/publish/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..c3b6a96287aa8ad4c9bf0e44ccba5d69b68ae02c
--- /dev/null
+++ b/notification/ans_standard/publish_test/publish/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,47 @@
+/*
+ * 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');
+ },
+}
diff --git a/notification/ans_standard/publish_test/publish/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/publish/entry/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..44a8575fc79bd4b302ef7b71508c2e1e8463156d
--- /dev/null
+++ b/notification/ans_standard/publish_test/publish/entry/src/main/js/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "pubIcon"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/notification/ans_standard/publish_test/publish/entry/src/main/js/resources/base/media/icon.png b/notification/ans_standard/publish_test/publish/entry/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/notification/ans_standard/publish_test/publish/entry/src/main/js/resources/base/media/icon.png differ
diff --git a/notification/ans_standard/publish_test/publish/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/publish/entry/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..b4bf1f69bd4ea40a7a2d833ece397af4d1d4bc37
--- /dev/null
+++ b/notification/ans_standard/publish_test/publish/entry/src/main/js/test/List.test.js
@@ -0,0 +1,15 @@
+/*
+ * 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
diff --git a/notification/ans_standard/publish_test/publish/entry/src/main/js/test/publish.js b/notification/ans_standard/publish_test/publish/entry/src/main/js/test/publish.js
new file mode 100644
index 0000000000000000000000000000000000000000..ae1d88a5fc754585f42cc41e043d5c0345374b8c
--- /dev/null
+++ b/notification/ans_standard/publish_test/publish/entry/src/main/js/test/publish.js
@@ -0,0 +1,2391 @@
+/*
+* 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;
+ * @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;
+ * @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;
+ * @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;
+ * @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;
+ * @tc.desc: function publish(request: NotificationRequest): Promise;
+ */
+ 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;
+ * @tc.desc: Verify that all notifications are cancelled successfully by calling the
+ cancelAll(): Promise 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;
+ * @tc.desc: function publish(request: NotificationRequest, callback: AsyncCallback): 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;
+ * @tc.desc: function publish(request: NotificationRequest, callback: AsyncCallback): 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;
+ * @tc.desc: function publish(request: NotificationRequest, callback: AsyncCallback): 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;
+ * @tc.desc: Verify that when the cancel(id: number, callback: AsyncCallback): 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;
+ * @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 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;
+ * @tc.desc: Verify that the cancel(id: number, callback: AsyncCallback): 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;
+ * @tc.desc: Verify that the cancel notification is successful by calling the
+ cancel(id: number, label: string, callback: AsyncCallback): 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
+ * @tc.desc: Verify that the cancel notification is successful by calling the
+ cancel(id: number, label?: string): Promise 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
+ * @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 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
+ * @tc.desc: Verify that the notification whose notification property isUnremovable is true
+ is canceled successfully by calling the cancel(id: number, label?: string): Promise 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;
+ * @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback): 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
+ * @tc.desc: Verify that the cancel(id: number, label?: string): Promise 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;
+ * @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback): 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;
+ * @tc.desc: Verify that the cancel(id: number, label?: string): Promise 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;
+ * @tc.desc: Verify that the cancel notification is successful by calling the
+ cancel(id: number, label: string, callback: AsyncCallback): 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
+ * @tc.desc: Verify that the cancel notification is successful by calling the
+ cancel(id: number, label?: string): Promise 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
+ * @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 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
+ * @tc.desc: Verify that the notification whose notification property isUnremovable is true
+ is canceled successfully by calling the cancel(id: number, label?: string): Promise 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;
+ * @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback): 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
+ * @tc.desc: Verify that the cancel(id: number, label?: string): Promise 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;
+ * @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback): 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;
+ * @tc.desc: Verify that the cancel(id: number, label?: string): Promise 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);
+ });
+})
diff --git a/notification/ans_standard/publish_test/publish/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/publish/signature/openharmony_sx.p7b
new file mode 100644
index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5
Binary files /dev/null and b/notification/ans_standard/publish_test/publish/signature/openharmony_sx.p7b differ
diff --git a/notification/ans_standard/publish_test/sub/BUILD.gn b/notification/ans_standard/publish_test/sub/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..774156c3273fb8f944dadf6ab2752e5ec6be16ac
--- /dev/null
+++ b/notification/ans_standard/publish_test/sub/BUILD.gn
@@ -0,0 +1,31 @@
+# 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"
+}
diff --git a/notification/ans_standard/publish_test/sub/Test.json b/notification/ans_standard/publish_test/sub/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..01ecd12aa15558cfedf66ebb3e363eb285e9e2d0
--- /dev/null
+++ b/notification/ans_standard/publish_test/sub/Test.json
@@ -0,0 +1,18 @@
+{
+ "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
+ }
+ ]
+}
diff --git a/notification/ans_standard/publish_test/sub/entry/.gitignore b/notification/ans_standard/publish_test/sub/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..796b96d1c402326528b4ba3c12ee9d92d0e212e9
--- /dev/null
+++ b/notification/ans_standard/publish_test/sub/entry/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/notification/ans_standard/publish_test/sub/entry/src/main/config.json b/notification/ans_standard/publish_test/sub/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..49d73730c73036d3d986d877d488136f5fec0394
--- /dev/null
+++ b/notification/ans_standard/publish_test/sub/entry/src/main/config.json
@@ -0,0 +1,62 @@
+{
+ "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
+ }
+ }
+ ]
+ }
+}
diff --git a/notification/ans_standard/publish_test/sub/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/sub/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b
--- /dev/null
+++ b/notification/ans_standard/publish_test/sub/entry/src/main/js/default/app.js
@@ -0,0 +1,22 @@
+/*
+ * 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');
+ }
+};
diff --git a/notification/ans_standard/publish_test/sub/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/sub/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/notification/ans_standard/publish_test/sub/entry/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
+}
\ No newline at end of file
diff --git a/notification/ans_standard/publish_test/sub/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/sub/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/notification/ans_standard/publish_test/sub/entry/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/notification/ans_standard/publish_test/sub/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/sub/entry/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/notification/ans_standard/publish_test/sub/entry/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/notification/ans_standard/publish_test/sub/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/sub/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..e42bdfdd29c1e18681d7f2924d1b98191d47fa4a
--- /dev/null
+++ b/notification/ans_standard/publish_test/sub/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ 订阅发布
+
+
diff --git a/notification/ans_standard/publish_test/sub/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/sub/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..c3b6a96287aa8ad4c9bf0e44ccba5d69b68ae02c
--- /dev/null
+++ b/notification/ans_standard/publish_test/sub/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,47 @@
+/*
+ * 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');
+ },
+}
diff --git a/notification/ans_standard/publish_test/sub/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/sub/entry/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..54d2d87ff6caa4a4ad4131e135e181723f18cd79
--- /dev/null
+++ b/notification/ans_standard/publish_test/sub/entry/src/main/js/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "Subscriber"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/notification/ans_standard/publish_test/sub/entry/src/main/js/resources/base/media/icon.png b/notification/ans_standard/publish_test/sub/entry/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/notification/ans_standard/publish_test/sub/entry/src/main/js/resources/base/media/icon.png differ
diff --git a/notification/ans_standard/publish_test/sub/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/sub/entry/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..0ce6d94a15c59e53ae647cc1afbffc13094a5a96
--- /dev/null
+++ b/notification/ans_standard/publish_test/sub/entry/src/main/js/test/List.test.js
@@ -0,0 +1,15 @@
+/*
+ * 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
diff --git a/notification/ans_standard/publish_test/sub/entry/src/main/js/test/Subscriber.js b/notification/ans_standard/publish_test/sub/entry/src/main/js/test/Subscriber.js
new file mode 100644
index 0000000000000000000000000000000000000000..1a6896db1c10b6ea51101319f96cc49b62f5b634
--- /dev/null
+++ b/notification/ans_standard/publish_test/sub/entry/src/main/js/test/Subscriber.js
@@ -0,0 +1,450 @@
+/*
+ * 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();
+ })
+})
+
diff --git a/notification/ans_standard/publish_test/sub/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/sub/signature/openharmony_sx.p7b
new file mode 100644
index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5
Binary files /dev/null and b/notification/ans_standard/publish_test/sub/signature/openharmony_sx.p7b differ