From 502a437ac827e4d8795ac9c2101c6ee57e6d06d2 Mon Sep 17 00:00:00 2001 From: daiweiqi Date: Tue, 25 Jan 2022 14:36:40 +0800 Subject: [PATCH] =?UTF-8?q?API=E6=8E=A5=E5=8F=A3=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: daiweiqi --- .../js/test/ActsSubscriber_test_unorder.js | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/entry/src/main/js/test/ActsSubscriber_test_unorder.js b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/entry/src/main/js/test/ActsSubscriber_test_unorder.js index 968b94533..b6035411b 100755 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/entry/src/main/js/test/ActsSubscriber_test_unorder.js +++ b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/entry/src/main/js/test/ActsSubscriber_test_unorder.js @@ -19,6 +19,7 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) { console.info("===========ActsSubscriberTestUnorderSystem start====================>"); var commonEventSubscriber1; var commonEventSubscriber2; + var commonEventSubscriber3; var array = [ Subscriber.Support.COMMON_EVENT_SHUTDOWN, Subscriber.Support.COMMON_EVENT_BATTERY_CHANGED, @@ -293,5 +294,48 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) { } }) }) + + /* + * @tc.number : ActsSubscriberTestUnorderSystem_0300 + * @tc.name : verify subscribe and publish : Check subscribe and publish system event data with permission + * : including multiple permissions + * @tc.desc : Check the subscriber can receive event "publish_event0100" type of the interface (by Promise) + */ + it('ActsSubscriberTestUnorderSystem_0300', 0, async function (done) { + console.info("===============ActsSubscriberTestUnorderSystem_0300 start==========================>"); + var commonEventSubscribeInfo = { + events: [ + Subscriber.Support.COMMON_EVENT_WIFI_P2P_CONN_STATE, + Subscriber.Support.COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_DISCOVERED, + Subscriber.Support.COMMON_EVENT_DISK_REMOVED, + Subscriber.Support.COMMON_EVENT_DISK_UNMOUNTED, + Subscriber.Support.COMMON_EVENT_DISK_MOUNTED, + Subscriber.Support.COMMON_EVENT_DISK_BAD_REMOVAL, + Subscriber.Support.COMMON_EVENT_DISK_UNMOUNTABLE, + Subscriber.Support.COMMON_EVENT_DISK_EJECT + ], + }; + + function subscriberCallBack003(err, data) { + console.info("==========================>subscriberCallBack003"); + } + + function unsubscribeCallback(err) { + console.info("===============>unsubscribeCallback"); + done(); + } + + Subscriber.createSubscriber( + commonEventSubscribeInfo + ).then(function (data) { + console.info("===============>ActsSubscriberTestUnorderSystem_0300=========createSubscriber promise"); + commonEventSubscriber3 = data; + Subscriber.subscribe(commonEventSubscriber3, subscriberCallBack003); + setTimeout(function (){ + console.debug("===============>ActsSubscriberTestUnorderSystem_0300 delay 3s=================="); + Subscriber.unsubscribe(commonEventSubscriber3, unsubscribeCallback); + }, 3000); + }) + }) }) -- GitLab