未验证 提交 6aa991e6 编写于 作者: O openharmony_ci 提交者: Gitee

!5379 【XTS】【事件通知子系统】 XTS 用例名称修改_master

Merge pull request !5379 from zhijianwen/master
...@@ -16,17 +16,17 @@ import notification from '@system.notification' ...@@ -16,17 +16,17 @@ import notification from '@system.notification'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function ActsNotificationShowTest() { export default function ActsNotificationShowTest() {
describe('ActsNotificationShowTest', function () { describe('SUB_NOTIFICATION_SHOW_TEST', function () {
const TAG = 'ActsNotificationShowTest ===> ' const TAG = 'SUB_NOTIFICATION_SHOW_TEST ===> '
console.info(TAG + "ActsNotificationShowTest START") console.info(TAG + "SUB_NOTIFICATION_SHOW_TEST START")
/* /*
* @tc.number: ActsNotificationShowTest_0100 * @tc.number: SUB_NOTIFICATION_SHOW_TEST_0100
* @tc.name: show() * @tc.name: show()
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0100', 0, async function (done) { it('SUB_NOTIFICATION_SHOW_TEST_0100', 0, async function (done) {
console.info(TAG + 'ActsNotificationShowTest_0100 START ') console.info(TAG + 'SUB_NOTIFICATION_SHOW_TEST_0100 START ')
let ShowNotificationOptions = { let ShowNotificationOptions = {
contentTitle: 'Title1', contentTitle: 'Title1',
contentText: 'This is a notification 001' contentText: 'This is a notification 001'
...@@ -40,12 +40,12 @@ export default function ActsNotificationShowTest() { ...@@ -40,12 +40,12 @@ export default function ActsNotificationShowTest() {
}) })
/* /*
* @tc.number: ActsNotificationShowTest_0200 * @tc.number: SUB_NOTIFICATION_SHOW_TEST_0200
* @tc.name: show() * @tc.name: show()
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0200', 0, async function (done) { it('SUB_NOTIFICATION_SHOW_TEST_0200', 0, async function (done) {
console.info(TAG + 'ActsNotificationShowTest_0200 START ') console.info(TAG + 'SUB_NOTIFICATION_SHOW_TEST_0200 START ')
let ShowNotificationOptions = { let ShowNotificationOptions = {
contentTitle: 123, contentTitle: 123,
contentText: 'This is a notification 002' contentText: 'This is a notification 002'
...@@ -58,12 +58,12 @@ export default function ActsNotificationShowTest() { ...@@ -58,12 +58,12 @@ export default function ActsNotificationShowTest() {
}) })
/* /*
* @tc.number: ActsNotificationShowTest_0300 * @tc.number: SUB_NOTIFICATION_SHOW_TEST_0300
* @tc.name: show() * @tc.name: show()
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0300', 0, async function (done) { it('SUB_NOTIFICATION_SHOW_TEST_0300', 0, async function (done) {
console.info(TAG + 'ActsNotificationShowTest_0300 START ') console.info(TAG + 'SUB_NOTIFICATION_SHOW_TEST_0300 START ')
let ShowNotificationOptions = {} let ShowNotificationOptions = {}
notification.show(ShowNotificationOptions) notification.show(ShowNotificationOptions)
expect(ShowNotificationOptions.contentTitle).assertEqual(undefined) expect(ShowNotificationOptions.contentTitle).assertEqual(undefined)
...@@ -71,12 +71,12 @@ export default function ActsNotificationShowTest() { ...@@ -71,12 +71,12 @@ export default function ActsNotificationShowTest() {
}) })
/* /*
* @tc.number: ActsNotificationShowTest_0400 * @tc.number: SUB_NOTIFICATION_SHOW_TEST_0400
* @tc.name: show() * @tc.name: show()
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0400', 0, async function (done) { it('SUB_NOTIFICATION_SHOW_TEST_0400', 0, async function (done) {
console.info(TAG + 'ActsNotificationShowTest_0400 START ') console.info(TAG + 'SUB_NOTIFICATION_SHOW_TEST_0400 START ')
let ActionResult = { let ActionResult = {
bundleName: 'com.example.notification', bundleName: 'com.example.notification',
abilityName: 'com.example.notification.MainAbility', abilityName: 'com.example.notification.MainAbility',
...@@ -102,12 +102,12 @@ export default function ActsNotificationShowTest() { ...@@ -102,12 +102,12 @@ export default function ActsNotificationShowTest() {
}) })
/* /*
* @tc.number: ActsNotificationShowTest_0500 * @tc.number: SUB_NOTIFICATION_SHOW_TEST_0500
* @tc.name: show() * @tc.name: show()
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0500', 0, async function (done) { it('SUB_NOTIFICATION_SHOW_TEST_0500', 0, async function (done) {
console.info(TAG + 'ActsNotificationShowTest_0500 START ') console.info(TAG + 'SUB_NOTIFICATION_SHOW_TEST_0500 START ')
let ActionResult = { let ActionResult = {
bundleName: 'com.example.notification', bundleName: 'com.example.notification',
abilityName: 'com.example.notification.MainAbility', abilityName: 'com.example.notification.MainAbility',
...@@ -133,12 +133,12 @@ export default function ActsNotificationShowTest() { ...@@ -133,12 +133,12 @@ export default function ActsNotificationShowTest() {
}) })
/* /*
* @tc.number: ActsNotificationShowTest_0600 * @tc.number: SUB_NOTIFICATION_SHOW_TEST_0600
* @tc.name: show() * @tc.name: show()
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0600', 0, async function (done) { it('SUB_NOTIFICATION_SHOW_TEST_0600', 0, async function (done) {
console.info(TAG + 'ActsNotificationShowTest_0600 START ') console.info(TAG + 'SUB_NOTIFICATION_SHOW_TEST_0600 START ')
let ActionResult = { let ActionResult = {
bundleName: '', bundleName: '',
abilityName: 'com.example.notification.MainAbility', abilityName: 'com.example.notification.MainAbility',
...@@ -163,12 +163,12 @@ export default function ActsNotificationShowTest() { ...@@ -163,12 +163,12 @@ export default function ActsNotificationShowTest() {
}) })
/* /*
* @tc.number: ActsNotificationShowTest_0700 * @tc.number: SUB_NOTIFICATION_SHOW_TEST_0700
* @tc.name: show() * @tc.name: show()
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0700', 0, async function (done) { it('SUB_NOTIFICATION_SHOW_TEST_0700', 0, async function (done) {
console.info(TAG + 'ActsNotificationShowTest_0700 START ') console.info(TAG + 'SUB_NOTIFICATION_SHOW_TEST_0700 START ')
let ActionResult = { let ActionResult = {
bundleName: 'com.example.notification', bundleName: 'com.example.notification',
abilityName: '', abilityName: '',
...@@ -193,12 +193,12 @@ export default function ActsNotificationShowTest() { ...@@ -193,12 +193,12 @@ export default function ActsNotificationShowTest() {
}) })
/* /*
* @tc.number: ActsNotificationShowTest_0800 * @tc.number: SUB_NOTIFICATION_SHOW_TEST_0800
* @tc.name: show() * @tc.name: show()
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0800', 0, async function (done) { it('SUB_NOTIFICATION_SHOW_TEST_0800', 0, async function (done) {
console.info(TAG + 'ActsNotificationShowTest_0800 START ') console.info(TAG + 'SUB_NOTIFICATION_SHOW_TEST_0800 START ')
let ActionResult = { let ActionResult = {
bundleName: 'com.example.notification', bundleName: 'com.example.notification',
abilityName: 'com.example.notification.MainAbility', abilityName: 'com.example.notification.MainAbility',
...@@ -223,12 +223,12 @@ export default function ActsNotificationShowTest() { ...@@ -223,12 +223,12 @@ export default function ActsNotificationShowTest() {
}) })
/* /*
* @tc.number: ActsNotificationShowTest_0900 * @tc.number: SUB_NOTIFICATION_SHOW_TEST_0900
* @tc.name: show() * @tc.name: show()
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_0900', 0, async function (done) { it('SUB_NOTIFICATION_SHOW_TEST_0900', 0, async function (done) {
console.info(TAG + 'ActsNotificationShowTest_0900 START ') console.info(TAG + 'SUB_NOTIFICATION_SHOW_TEST_0900 START ')
let ActionResult = { let ActionResult = {
bundleName: 'com.example.notification', bundleName: 'com.example.notification',
abilityName: 'com.example.notification.MainAbility', abilityName: 'com.example.notification.MainAbility',
...@@ -251,12 +251,12 @@ export default function ActsNotificationShowTest() { ...@@ -251,12 +251,12 @@ export default function ActsNotificationShowTest() {
}) })
/* /*
* @tc.number: ActsNotificationShowTest_1000 * @tc.number: SUB_NOTIFICATION_SHOW_TEST_1000
* @tc.name: show() * @tc.name: show()
* @tc.desc: verify the function of show * @tc.desc: verify the function of show
*/ */
it('ActsNotificationShowTest_1000', 0, async function (done) { it('SUB_NOTIFICATION_SHOW_TEST_1000', 0, async function (done) {
console.info(TAG + 'ActsNotificationShowTest_1000 START ') console.info(TAG + 'SUB_NOTIFICATION_SHOW_TEST_1000 START ')
let ActionResult = { let ActionResult = {
bundleName: 'com.example.notification', bundleName: 'com.example.notification',
abilityName: 'com.example.notification.MainAbility', abilityName: 'com.example.notification.MainAbility',
...@@ -278,8 +278,9 @@ export default function ActsNotificationShowTest() { ...@@ -278,8 +278,9 @@ export default function ActsNotificationShowTest() {
done() done()
}) })
console.info(TAG + "ActsNotificationShowTest END"); console.info(TAG + "SUB_NOTIFICATION_SHOW_TEST END");
}) })
} }
...@@ -16,8 +16,9 @@ import Subscriber from '@ohos.commonEvent' ...@@ -16,8 +16,9 @@ import Subscriber from '@ohos.commonEvent'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function ActsSubscriberTestOrder() { export default function ActsSubscriberTestOrder() {
describe('ActsSubscriberTestOrder', function () { describe('SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST', function () {
console.info('===========ActsSubscriberTestOrder start====================>'); let TAG = 'SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST ===>'
console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST START`)
let num2 = 0; let num2 = 0;
let order = false; let order = false;
let commonEventSubscriber0100; let commonEventSubscriber0100;
...@@ -40,12 +41,12 @@ describe('ActsSubscriberTestOrder', function () { ...@@ -40,12 +41,12 @@ describe('ActsSubscriberTestOrder', function () {
} }
/* /*
* @tc.number : ActsSubscriberTestOrder_0100 * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0100
* @tc.name : verify subscribe and publish : Check subscribe same event and publish common ordered event * @tc.name : verify subscribe and publish : Check subscribe same event and publish common ordered event
* @tc.desc : Check the subscriber can receive event "publish_event0100" type of the interface (by Promise) * @tc.desc : Check the subscriber can receive event "publish_event0100" type of the interface (by Promise)
*/ */
it('ActsSubscriberTestOrder_0100', 0, async function (done) { it('SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0100', 0, async function (done) {
console.info('===============ActsSubscriberTestOrder_0100===============>'); console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0100 START`)
let commonEventSubscribeInfo1 = { let commonEventSubscribeInfo1 = {
events: ['publish_event0100'], events: ['publish_event0100'],
...@@ -148,16 +149,17 @@ describe('ActsSubscriberTestOrder', function () { ...@@ -148,16 +149,17 @@ describe('ActsSubscriberTestOrder', function () {
}, 100); }, 100);
}); });
}) })
console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0100 END`)
}) })
/* /*
* @tc.number : ActsSubscriberTestOrder_0200 * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0200
* @tc.name : verify subscribe and publish : Check subscribe different event * @tc.name : verify subscribe and publish : Check subscribe different event
* and twice publish common ordered event and check unsubscribe event * and twice publish common ordered event and check unsubscribe event
* @tc.desc : Check the subscriber can receive event "publish_event0200" type of the interface (by Promise) * @tc.desc : Check the subscriber can receive event "publish_event0200" type of the interface (by Promise)
*/ */
it ('ActsSubscriberTestOrder_0200', 0, async function (done) { it ('SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0200', 0, async function (done) {
console.info('===============ActsSubscriberTestOrder_0200===============>'); console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0200 START`)
let commonEventSubscribeInfo1 = { let commonEventSubscribeInfo1 = {
events: ['publish_event0200', events: ['publish_event0200',
...@@ -253,16 +255,17 @@ describe('ActsSubscriberTestOrder', function () { ...@@ -253,16 +255,17 @@ describe('ActsSubscriberTestOrder', function () {
}, 100); }, 100);
}); });
}) })
console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0200 END`)
}) })
/* /*
* @tc.number : ActsSubscriberTestOrder_0300 * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0300
* @tc.name : verify subscribe and publish : Check subscribe different events * @tc.name : verify subscribe and publish : Check subscribe different events
* and some publish common ordered events * and some publish common ordered events
* @tc.desc : Check the subscriber can receive event "publish_event0301" type of the interface (by Promise) * @tc.desc : Check the subscriber can receive event "publish_event0301" type of the interface (by Promise)
*/ */
it ('ActsSubscriberTestOrder_0300', 0, async function (done) { it ('SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0300', 0, async function (done) {
console.info('===============ActsSubscriberTestOrder_0300===============>'); console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0300 START`)
let commonEventSubscribeInfo1 = { let commonEventSubscribeInfo1 = {
events: ['publish_event0301'], events: ['publish_event0301'],
...@@ -361,16 +364,17 @@ describe('ActsSubscriberTestOrder', function () { ...@@ -361,16 +364,17 @@ describe('ActsSubscriberTestOrder', function () {
} }
}); });
}) })
console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0300 END`)
}) })
/* /*
* @tc.number : ActsSubscriberTestOrder_0400 * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0400
* @tc.name : verify subscribe and publish : Check subscribe same events * @tc.name : verify subscribe and publish : Check subscribe same events
* and publish common ordered events and check abort event * and publish common ordered events and check abort event
* @tc.desc : Check the subscriber can receive event "publish_eventOrder0400" type of the interface by promise * @tc.desc : Check the subscriber can receive event "publish_eventOrder0400" type of the interface by promise
*/ */
it ('ActsSubscriberTestOrder_0400', 0, async function (done) { it ('SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0400', 0, async function (done) {
console.info('===============ActsSubscriberTestOrder_0400===============>'); console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0400 START`)
let commonEventSubscribeInfo1 = { let commonEventSubscribeInfo1 = {
events: ['publish_eventOrder0400'], events: ['publish_eventOrder0400'],
...@@ -444,15 +448,16 @@ describe('ActsSubscriberTestOrder', function () { ...@@ -444,15 +448,16 @@ describe('ActsSubscriberTestOrder', function () {
}, 100); }, 100);
}) })
}) })
console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0400 END`)
}) })
/* /*
* @tc.number : ActsSubscriberTestOrder_0500 * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0500
* @tc.name : verify subscribe and publish : Check subscriber same events * @tc.name : verify subscribe and publish : Check subscriber same events
* @tc.desc : Check the subscriber can receive event "publish_event0500" type of the interface (by promise) * @tc.desc : Check the subscriber can receive event "publish_event0500" type of the interface (by promise)
*/ */
it ('ActsSubscriberTestOrder_0500', 0, async function (done) { it ('SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0500', 0, async function (done) {
console.info('===============ActsSubscriberTestOrder_0500===============>'); console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0500 START`)
let commonEventSubscribeInfo1 = { let commonEventSubscribeInfo1 = {
events: ['publish_event0500'], events: ['publish_event0500'],
...@@ -531,6 +536,8 @@ describe('ActsSubscriberTestOrder', function () { ...@@ -531,6 +536,8 @@ describe('ActsSubscriberTestOrder', function () {
}, 100); }, 100);
}) })
}) })
console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0400 END`)
}) })
console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST END`)
}) })
} }
...@@ -16,11 +16,12 @@ import commonEvent from '@ohos.commonEvent' ...@@ -16,11 +16,12 @@ import commonEvent from '@ohos.commonEvent'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function ActsSubscriberTestUnorderSystem() { export default function ActsSubscriberTestUnorderSystem() {
describe('ActsSubscriberTestUnorderSystem', async function (done) { describe('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_SYSTEM_TEST', async function () {
let TAG = 'Subscriber_Unorder_System ===>' let TAG = 'SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_SYSTEM_TEST ===>'
it('Subscriber_Unorder_System_001', 0, async function (done) { console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_SYSTEM_TEST START`)
console.info(TAG + 'Subscriber_Unorder_System_001 START') it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_SYSTEM_TEST_0100', 0, async function (done) {
const CommonEventSubscriberInfo = { console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_SYSTEM_TEST START`)
let CommonEventSubscriberInfo = {
events: [ events: [
commonEvent.Support.COMMON_EVENT_SHUTDOWN, commonEvent.Support.COMMON_EVENT_SHUTDOWN,
commonEvent.Support.COMMON_EVENT_BATTERY_CHANGED, commonEvent.Support.COMMON_EVENT_BATTERY_CHANGED,
...@@ -158,7 +159,7 @@ export default function ActsSubscriberTestUnorderSystem() { ...@@ -158,7 +159,7 @@ export default function ActsSubscriberTestUnorderSystem() {
commonEvent.Support.COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED, commonEvent.Support.COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED,
commonEvent.Support.COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED, commonEvent.Support.COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED,
commonEvent.Support.COMMON_EVENT_USER_ADDED, commonEvent.Support.COMMON_EVENT_USER_ADDED,
//commonEvent.Support.COMMON_EVENT_USER_REMOVED, // commonEvent.Support.COMMON_EVENT_USER_REMOVED,
commonEvent.Support.COMMON_EVENT_ABILITY_ADDED, commonEvent.Support.COMMON_EVENT_ABILITY_ADDED,
commonEvent.Support.COMMON_EVENT_ABILITY_REMOVED, commonEvent.Support.COMMON_EVENT_ABILITY_REMOVED,
commonEvent.Support.COMMON_EVENT_ABILITY_UPDATED, commonEvent.Support.COMMON_EVENT_ABILITY_UPDATED,
...@@ -178,41 +179,42 @@ export default function ActsSubscriberTestUnorderSystem() { ...@@ -178,41 +179,42 @@ export default function ActsSubscriberTestUnorderSystem() {
commonEvent.Support.COMMON_EVENT_SPN_INFO_CHANGED commonEvent.Support.COMMON_EVENT_SPN_INFO_CHANGED
] ]
} }
let CommonEventSubscriber
let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) commonEvent.createSubscriber(CommonEventSubscriberInfo).then((data) => {
if (CommonEventSubscriber == undefined) { console.info(`${TAG} createSubscriber success : ${CommonEventSubscriberInfo}`)
console.info(TAG + ': createSubscriber failed! Err.Info ===> ' + JSON.stringify(CommonEventSubscriber)) CommonEventSubscriber = data
expect(true).assertTrue()
commonEvent.subscribe(CommonEventSubscriber, (err, CommonEventData) => {
if (err.code) {
console.info(`${TAG} subscribe err : ${err.code}`)
expect(false).assertTrue()
done()
} else {
console.info(`${TAG} subscribe success : ${CommonEventData}`)
expect(true).assertTrue()
}
})
}).catch((err) => {
console.info(`${TAG} createSubscriber err ${err}`)
expect(false).assertTrue() expect(false).assertTrue()
done() done()
} else {
console.info(TAG + ': createSubscriber successed! Subscriber.Info ===> ' + JSON.stringify(CommonEventSubscriber))
expect(true).assertTrue()
}
await commonEvent.subscribe(CommonEventSubscriber, (err, CommonEventData) => {
if (err.code) {
console.info(TAG + ': subscribe failed! Err.Info ===> ' + JSON.stringify(err.code))
expect(false).assertTrue()
done()
} else {
console.info(TAG + ': subscribe successed! CommonEventData.Info ===> ' + JSON.stringify(CommonEventData))
expect(true).assertTrue()
}
}) })
for (let i = 0; i < CommonEventSubscriberInfo.events.length; i++) { for (let i = 0; i < CommonEventSubscriberInfo.events.length; i++) {
await commonEvent.publish(CommonEventSubscriberInfo.events[i], (err) => { await commonEvent.publish(CommonEventSubscriberInfo.events[i], (err) => {
if (err.code) { if (err.code) {
console.info(TAG + ': publish failed! event.Info ===> ' + JSON.stringify(CommonEventSubscriberInfo.events[i])) console.info(`${TAG} publish err : ${err.code}`)
expect(false).assertTrue() expect(false).assertTrue()
done() done()
} else { } else {
console.info(TAG + ': publish successed! event.Info ===> ' + JSON.stringify(CommonEventSubscriberInfo.events[i])) console.info(`${TAG} publish success : ${CommonEventSubscriberInfo.events[i]}`)
expect(true).assertTrue() expect(true).assertTrue()
done() done()
} }
}) })
} }
}) })
console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_SYSTEM_TEST END`)
}) })
} }
...@@ -16,9 +16,9 @@ import commonEvent from '@ohos.commonEvent'; ...@@ -16,9 +16,9 @@ import commonEvent from '@ohos.commonEvent';
import {describe,beforeAll,beforeEach,afterEach,afterAll,it,expect,} from "@ohos/hypium"; import {describe,beforeAll,beforeEach,afterEach,afterAll,it,expect,} from "@ohos/hypium";
export default function ActsSubscriberTestUnorder() { export default function ActsSubscriberTestUnorder() {
describe('ActsSubscriberTestUnorder', function () { describe('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST', function () {
let TAG = 'SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST ===>';
let TAG = 'ActsSubscriberTestUnorder ===>'; console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST START`)
let CommonEventSubscriberInfo = { let CommonEventSubscriberInfo = {
events: ['event'], events: ['event'],
...@@ -32,12 +32,12 @@ export default function ActsSubscriberTestUnorder() { ...@@ -32,12 +32,12 @@ export default function ActsSubscriberTestUnorder() {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => setTimeout(resolve, ms));
} }
/* /*
* @tc.number : ActsSubscriberTestUnorder_0100 * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0100
* @tc.name : check * @tc.name : check
* @tc.desc : getSubscribeInfo(callback: AsyncCallback<CommonEventSubscribeInfo>): void * @tc.desc : getSubscribeInfo(callback: AsyncCallback<CommonEventSubscribeInfo>): void
*/ */
it('ActsSubscriberTestUnorder_0100', 0, async function (done) { it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0100', 0, async function (done) {
console.info(TAG + 'ActsSubscriberTestUnorder_0100 START ') console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0100 START`)
let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo)
if (CommonEventSubscriber == undefined) { if (CommonEventSubscriber == undefined) {
console.info(TAG + ': createSubscriber failed! Err.Info ===> ' + JSON.stringify(CommonEventSubscriber)) console.info(TAG + ': createSubscriber failed! Err.Info ===> ' + JSON.stringify(CommonEventSubscriber))
...@@ -64,15 +64,16 @@ export default function ActsSubscriberTestUnorder() { ...@@ -64,15 +64,16 @@ export default function ActsSubscriberTestUnorder() {
done() done()
} }
}) })
console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0100 END`)
}) })
/* /*
* @tc.number : ActsSubscriberTestUnorder_0200 * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0200
* @tc.name : check * @tc.name : check
* @tc.desc : getSubscribeInfo(): Promise<CommonEventSubscribeInfo> * @tc.desc : getSubscribeInfo(): Promise<CommonEventSubscribeInfo>
*/ */
it('ActsSubscriberTestUnorder_0200', 0, async function (done) { it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0200', 0, async function (done) {
console.info(TAG + 'ActsSubscriberTestUnorder_0200 START ') console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0200 START`)
let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo)
if (CommonEventSubscriber == undefined) { if (CommonEventSubscriber == undefined) {
console.info(TAG + ': createSubscriber failed! Err.Info ===> ' + JSON.stringify(CommonEventSubscriber)) console.info(TAG + ': createSubscriber failed! Err.Info ===> ' + JSON.stringify(CommonEventSubscriber))
...@@ -96,16 +97,16 @@ export default function ActsSubscriberTestUnorder() { ...@@ -96,16 +97,16 @@ export default function ActsSubscriberTestUnorder() {
console.info(TAG + ': getSubscribeInfo promise failed! event.Info ===> ' + JSON.stringify(err.code)) console.info(TAG + ': getSubscribeInfo promise failed! event.Info ===> ' + JSON.stringify(err.code))
expect(false).assertTrue() expect(false).assertTrue()
}) })
console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0200 END`)
}) })
/* /*
* @tc.number : ActsgetSubscribeInfoTest_0300 * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0300
* @tc.name : Check the subscriber can receive event "@#¥#3243adsafdf_" type of the interface * @tc.name : Check the subscriber can receive event "@#¥#3243adsafdf_" type of the interface
* @tc.desc : getSubscribeInfo(callback: AsyncCallback<CommonEventSubscribeInfo>): void * @tc.desc : getSubscribeInfo(callback: AsyncCallback<CommonEventSubscribeInfo>): void
*/ */
it('ActsgetSubscribeInfoTest_0300', 0, async function (done) { it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0300', 0, async function (done) {
console.info(TAG + 'ActsgetSubscribeInfoTest_0100 START ') console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0300 START`)
CommonEventSubscriberInfo.events[0] = '@#¥#3243adsafdf_' CommonEventSubscriberInfo.events[0] = '@#¥#3243adsafdf_'
let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo)
if (CommonEventSubscriber == undefined) { if (CommonEventSubscriber == undefined) {
...@@ -133,15 +134,16 @@ export default function ActsSubscriberTestUnorder() { ...@@ -133,15 +134,16 @@ export default function ActsSubscriberTestUnorder() {
done() done()
} }
}) })
console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0300 END`)
}) })
/* /*
* @tc.number : ActsgetSubscribeInfoTest_0400 * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0400
* @tc.name : Check the subscriber can receive event "@#¥#3243adsafdf_" type of the interface (by Promise) * @tc.name : Check the subscriber can receive event "@#¥#3243adsafdf_" type of the interface (by Promise)
* @tc.desc : getSubscribeInfo(callback: AsyncCallback<CommonEventSubscribeInfo>): void * @tc.desc : getSubscribeInfo(callback: AsyncCallback<CommonEventSubscribeInfo>): void
*/ */
it('ActsSubscriberTestUnorder_0400', 0, async function (done) { it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0400', 0, async function (done) {
console.info(TAG + 'ActsSubscriberTestUnorder_0400 START ') console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0400 START`)
CommonEventSubscriberInfo.events[0] = '@#¥#3243adsafdf_' CommonEventSubscriberInfo.events[0] = '@#¥#3243adsafdf_'
let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo)
if (CommonEventSubscriber == undefined) { if (CommonEventSubscriber == undefined) {
...@@ -166,16 +168,16 @@ export default function ActsSubscriberTestUnorder() { ...@@ -166,16 +168,16 @@ export default function ActsSubscriberTestUnorder() {
console.info(TAG + ': getSubscribeInfo promise failed! event.Info ===> ' + JSON.stringify(err.code)) console.info(TAG + ': getSubscribeInfo promise failed! event.Info ===> ' + JSON.stringify(err.code))
expect(false).assertTrue() expect(false).assertTrue()
}) })
console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0400 END`)
}) })
/* /*
* @tc.number : ActsSubscriberTestUnorder_0500 * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0500
* @tc.name : check * @tc.name : check
* @tc.desc : isOrderedCommonEvent(callback: AsyncCallback<boolean>): void * @tc.desc : isOrderedCommonEvent(callback: AsyncCallback<boolean>): void
*/ */
it('ActsSubscriberTestUnorder_0500', 0, async function (done) { it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0500', 0, async function (done) {
console.info(TAG + 'ActsSubscriberTestUnorder_0500 START ') console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0500 START`)
CommonEventSubscriberInfo.events[0] = 'publish_event_0500' CommonEventSubscriberInfo.events[0] = 'publish_event_0500'
CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0500' CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0500'
CommonEventSubscriberInfo.priority = 10 CommonEventSubscriberInfo.priority = 10
...@@ -238,16 +240,17 @@ export default function ActsSubscriberTestUnorder() { ...@@ -238,16 +240,17 @@ export default function ActsSubscriberTestUnorder() {
} }
}) })
await sleep(5000); await sleep(5000)
console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0500 END`)
}) })
/* /*
* @tc.number : ActsSubscriberTestUnorder_0600 * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0600
* @tc.name : check * @tc.name : check
* @tc.desc : isOrderedCommonEvent(): Promise<boolean> * @tc.desc : isOrderedCommonEvent(): Promise<boolean>
*/ */
it('ActsSubscriberTestUnorder_0600', 0, async function (done) { it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0600', 0, async function (done) {
console.info(TAG + 'ActsSubscriberTestUnorder_0600 START ') console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0600 START`)
CommonEventSubscriberInfo.events[0] = 'publish_event_0600' CommonEventSubscriberInfo.events[0] = 'publish_event_0600'
CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0600' CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0600'
CommonEventSubscriberInfo.priority = 10 CommonEventSubscriberInfo.priority = 10
...@@ -310,17 +313,17 @@ export default function ActsSubscriberTestUnorder() { ...@@ -310,17 +313,17 @@ export default function ActsSubscriberTestUnorder() {
} }
}) })
await sleep(500) await sleep(5000)
console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0600 END`)
}) })
/* /*
* @tc.number : ActsSubscriberTestUnorder_0700 * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0700
* @tc.name : check * @tc.name : check
* @tc.desc : iisStickyCommonEvent(callback: AsyncCallback<boolean>): void * @tc.desc : iisStickyCommonEvent(callback: AsyncCallback<boolean>): void
*/ */
it('ActsSubscriberTestUnorder_0700', 0, async function (done) { it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0700', 0, async function (done) {
console.info(TAG + 'ActsSubscriberTestUnorder_0700 START ') console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0700 START`)
CommonEventSubscriberInfo.events[0] = 'publish_event_0700' CommonEventSubscriberInfo.events[0] = 'publish_event_0700'
CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0700' CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0700'
CommonEventSubscriberInfo.priority = 10 CommonEventSubscriberInfo.priority = 10
...@@ -383,16 +386,17 @@ export default function ActsSubscriberTestUnorder() { ...@@ -383,16 +386,17 @@ export default function ActsSubscriberTestUnorder() {
} }
}) })
await sleep(5000); await sleep(5000)
console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0700 END`)
}) })
/* /*
* @tc.number : ActsSubscriberTestUnorder_0800 * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0800
* @tc.name : check * @tc.name : check
* @tc.desc : isStickyCommonEvent(): Promise<boolean> * @tc.desc : isStickyCommonEvent(): Promise<boolean>
*/ */
it('ActsSubscriberTestUnorder_0800', 0, async function (done) { it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0800', 0, async function (done) {
console.info(TAG + 'ActsSubscriberTestUnorder_0800 START ') console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0800 START`)
CommonEventSubscriberInfo.events[0] = 'publish_event_0800' CommonEventSubscriberInfo.events[0] = 'publish_event_0800'
CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0800' CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0800'
CommonEventSubscriberInfo.priority = 10 CommonEventSubscriberInfo.priority = 10
...@@ -452,17 +456,17 @@ export default function ActsSubscriberTestUnorder() { ...@@ -452,17 +456,17 @@ export default function ActsSubscriberTestUnorder() {
done() done()
} }
}) })
await sleep(5000)
await sleep(500) console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0800 END`)
}) })
/* /*
* @tc.number : ActsSubscriberTestUnorder_0900 * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0900
* @tc.name : check properties * @tc.name : check properties
* @tc.desc : CommonEventPublishData * @tc.desc : CommonEventPublishData
*/ */
it('ActsSubscriberTestUnorder_0900', 0, async function (done) { it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0900', 0, async function (done) {
console.info(TAG + 'ActsSubscriberTestUnorder_0900 START ') console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0900 START`)
CommonEventSubscriberInfo.events[0] = 'publish_event_0900' CommonEventSubscriberInfo.events[0] = 'publish_event_0900'
CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0900' CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0900'
CommonEventSubscriberInfo.priority = 10 CommonEventSubscriberInfo.priority = 10
...@@ -511,6 +515,8 @@ export default function ActsSubscriberTestUnorder() { ...@@ -511,6 +515,8 @@ export default function ActsSubscriberTestUnorder() {
}) })
await sleep(5000) await sleep(5000)
console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0900 END`)
}) })
console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST END`)
}) })
} }
...@@ -16,139 +16,139 @@ import emitter from '@ohos.events.emitter' ...@@ -16,139 +16,139 @@ import emitter from '@ohos.events.emitter'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function EmitterTest() { export default function EmitterTest() {
describe('EmitterTest', function () { describe('SUB_NOTIFICATION_CES_EMITTER_TEST', function () {
const TAG = 'EmitterTest ===> ' const TAG = 'SUB_NOTIFICATION_CES_EMITTER_TEST ===> '
console.info(TAG + 'EmitterTest START') console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST START`)
let innerEvent = { let innerEvent = {
eventId: undefined, eventId: undefined,
priority: undefined priority: undefined
} }
let eventData = { let eventData = {
data: { data: {
'id': undefined, 'id': undefined,
'content': undefined 'content': undefined
} }
} }
function EmitterCallback(eventData) { function EmitterCallback(eventData) {
console.info(TAG + 'eventData.id: ' + JSON.stringify(eventData.data.id)); console.info(TAG + 'eventData.id: ' + JSON.stringify(eventData.data.id));
console.info(TAG + 'eventData.content: ' + JSON.stringify(eventData.data.content)); console.info(TAG + 'eventData.content: ' + JSON.stringify(eventData.data.content));
if (eventData.data.id == 0) { if (eventData.data.id == 0) {
expect(eventData.data.content).assertEqual('message_0'); expect(eventData.data.content).assertEqual('message_0');
} else if (eventData.data.id == 1) { } else if (eventData.data.id == 1) {
expect(eventData.data.content).assertEqual('message_1'); expect(eventData.data.content).assertEqual('message_1');
} else if (eventData.data.id == 2) { } else if (eventData.data.id == 2) {
expect(eventData.data.content).assertEqual('message_2'); expect(eventData.data.content).assertEqual('message_2');
} else if (eventData.data.id == 3) { } else if (eventData.data.id == 3) {
expect(eventData.data.content).assertEqual('message_3'); expect(eventData.data.content).assertEqual('message_3');
} else if (eventData.data.id == 4) { } else if (eventData.data.id == 4) {
expect(eventData.data.content).assertEqual('message_4'); expect(eventData.data.content).assertEqual('message_4');
} else if (eventData.data.id == 5) { } else if (eventData.data.id == 5) {
expect(eventData.data.content).assertEqual('message_5'); expect(eventData.data.content).assertEqual('message_5');
} }
} }
/* /*
* @tc.number : EmitterTest_0100 * @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_0100
* @tc.name : verify on : on(event: InnerEvent, callback: Callback<EventData>): void * @tc.name : verify on : on(event: InnerEvent, callback: Callback<EventData>): void
* @tc.desc : emitter.EventPriority.IDLE * @tc.desc : emitter.EventPriority.IDLE
*/ */
it('EmitterTest_0100', 0, async function (done) { it('SUB_NOTIFICATION_CES_EMITTER_TEST_0100', 0, async function (done) {
console.info(TAG + 'EmitterTest_0100 START') console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0100 START`)
innerEvent.eventId = 1 innerEvent.eventId = 1
innerEvent.priority = emitter.EventPriority.IDLE innerEvent.priority = emitter.EventPriority.IDLE
eventData.data.id = 0 eventData.data.id = 0
eventData.data.content = 'message_0' eventData.data.content = 'message_0'
emitter.on(innerEvent, EmitterCallback) emitter.on(innerEvent, EmitterCallback)
emitter.emit(innerEvent, eventData) emitter.emit(innerEvent, eventData)
eventData.data.id = 1 eventData.data.id = 1
eventData.data.content = 'message_1' eventData.data.content = 'message_1'
emitter.emit(innerEvent, eventData) emitter.emit(innerEvent, eventData)
console.info(TAG + 'EmitterTest_0100 END') console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0100 END`)
done() done()
}) })
/* /*
* @tc.number : EmitterTest_0200 * @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_0200
* @tc.name : verify on : once(event: InnerEvent, callback: Callback<EventData>): void * @tc.name : verify on : once(event: InnerEvent, callback: Callback<EventData>): void
* @tc.desc : emitter.EventPriority.LOW * @tc.desc : emitter.EventPriority.LOW
*/ */
it('EmitterTest_0200', 0, async function (done) { it('SUB_NOTIFICATION_CES_EMITTER_TEST_0200', 0, async function (done) {
console.info(TAG + 'EmitterTest_0200 START') console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0200 START`)
innerEvent.eventId = 2 innerEvent.eventId = 2
innerEvent.priority = emitter.EventPriority.LOW innerEvent.priority = emitter.EventPriority.LOW
eventData.data.id = 2 eventData.data.id = 2
eventData.data.content = 'message_2' eventData.data.content = 'message_2'
emitter.once(innerEvent, EmitterCallback) emitter.once(innerEvent, EmitterCallback)
emitter.emit(innerEvent, eventData) emitter.emit(innerEvent, eventData)
console.info(TAG + 'EmitterTest_0200 END') console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0200 END`)
done() done()
}) })
/* /*
* @tc.number : EmitterTest_0300 * @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_0300
* @tc.name : verify on : emit(event: InnerEvent, data?: EventData): void * @tc.name : verify on : emit(event: InnerEvent, data?: EventData): void
* @tc.desc : emitter.EventPriority.HIGH * @tc.desc : emitter.EventPriority.HIGH
*/ */
it('EmitterTest_0300', 0, async function (done) { it('SUB_NOTIFICATION_CES_EMITTER_TEST_0300', 0, async function (done) {
console.info(TAG + 'EmitterTest_0300 START') console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0300 START`)
innerEvent.eventId = 3 innerEvent.eventId = 3
innerEvent.priority = emitter.EventPriority.HIGH innerEvent.priority = emitter.EventPriority.HIGH
eventData.data.id = 3 eventData.data.id = 3
eventData.data.content = 'message_3' eventData.data.content = 'message_3'
emitter.once(innerEvent, EmitterCallback) emitter.once(innerEvent, EmitterCallback)
emitter.emit(innerEvent, eventData) emitter.emit(innerEvent, eventData)
console.info(TAG + 'EmitterTest_0300 END') console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0300 END`)
done() done()
}) })
/* /*
* @tc.number : EmitterTest_0400 * @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_0400
* @tc.name : verify on : emit(event: InnerEvent, data?: EventData): void * @tc.name : verify on : emit(event: InnerEvent, data?: EventData): void
* @tc.desc : emitter.EventPriority.IMMEDIATE * @tc.desc : emitter.EventPriority.IMMEDIATE
*/ */
it('EmitterTest_0400', 0, async function (done) { it('SUB_NOTIFICATION_CES_EMITTER_TEST_0400', 0, async function (done) {
console.info(TAG + 'EmitterTest_0400 START') console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0400 START`)
innerEvent.eventId = 4 innerEvent.eventId = 4
innerEvent.priority = emitter.EventPriority.IMMEDIATE innerEvent.priority = emitter.EventPriority.IMMEDIATE
eventData.data.id = 4 eventData.data.id = 4
eventData.data.content = 'message_4' eventData.data.content = 'message_4'
emitter.once(innerEvent, EmitterCallback) emitter.once(innerEvent, EmitterCallback)
emitter.emit(innerEvent, eventData) emitter.emit(innerEvent, eventData)
console.info(TAG + 'EmitterTest_0400 END') console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0400 END`)
done() done()
}) })
/* /*
* @tc.number : EmitterTest_0500 * @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_0500
* @tc.name : verify on : off(eventId: number): void * @tc.name : verify on : off(eventId: number): void
* @tc.desc : emitter.EventPriority.IMMEDIATE * @tc.desc : emitter.EventPriority.IMMEDIATE
*/ */
it('EmitterTest_0500', 0, async function (done) { it('SUB_NOTIFICATION_CES_EMITTER_TEST_0500', 0, async function (done) {
console.info(TAG + 'EmitterTest_0500 START') console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0500 START`)
innerEvent.eventId = 5 innerEvent.eventId = 5
innerEvent.priority = emitter.EventPriority.IMMEDIATE innerEvent.priority = emitter.EventPriority.IMMEDIATE
eventData.data.id = 5 eventData.data.id = 5
eventData.data.content = 'message_5' eventData.data.content = 'message_5'
emitter.once(innerEvent, EmitterCallback) emitter.once(innerEvent, EmitterCallback)
emitter.emit(innerEvent, eventData) emitter.emit(innerEvent, eventData)
emitter.off(5) emitter.off(5)
console.info(TAG + 'EmitterTest_0500 END') console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0500 END`)
done() done()
}) })
console.info(TAG + 'EmitterTest END') console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST END`)
}) })
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册