diff --git a/notification/ans_standard/actsNotificationDistributedTest/BUILD.gn b/notification/ans_standard/actsNotificationDistributedTest/BUILD.gn index 52609ab77755f8c5dbb436b881adb66ab5163ab8..be375b3f5a8bb0cf860d601c34f0d658162330c6 100644 --- a/notification/ans_standard/actsNotificationDistributedTest/BUILD.gn +++ b/notification/ans_standard/actsNotificationDistributedTest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2022 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 diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/app.js b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/app.js index b58cf3c570b660c6f6f8cdcb1b317d67687deb29..5b800cb12b0028e95ecb52e5684d1d336ae51e1c 100644 --- a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/app.js +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/app.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 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 diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/pages/index/index.js index 312c30c0c27535e4ee98fce4ca802506159ba2d1..329d972406d066b00b64da8a3d363b64f31367a9 100644 --- a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/pages/index/index.js +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/MainAbility/pages/index/index.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 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 diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/test/ActsNotificationDistributedTest.js b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/test/ActsNotificationDistributedTest.js index 96d65df73d5a771996441502d5c163affa20ec41..fe4b1ef9746fb40f6bd0c17f95f3b97873a2400c 100644 --- a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/test/ActsNotificationDistributedTest.js +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/test/ActsNotificationDistributedTest.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 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 @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import notification from '@ohos.notification'; +import notification from '@ohos.notification' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' export default function ActsNotificationDistributedTest() { diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/test/ActsNotificationManagerDistributedTest.js b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/test/ActsNotificationManagerDistributedTest.js new file mode 100644 index 0000000000000000000000000000000000000000..49332689b402830a1d6ae49e94db7b0ceb3f375d --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/test/ActsNotificationManagerDistributedTest.js @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2022 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 notificationManager from '@ohos.notificationManager' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +export default function ActsNotificationManagerDistributedTest() { + describe('SUB_NOTIFICATION_ANS_MANAGER_IS_DISTRIBUTED_ENABLED_TEST', function () { + let TAG = 'SUB_NOTIFICATION_ANS_MANAGER_IS_DISTRIBUTED_ENABLED_TEST ===>' + console.info(TAG + 'SUB_NOTIFICATION_ANS_MANAGER_IS_DISTRIBUTED_ENABLED_TEST START') + + /* + * @tc.number : SUB_NOTIFICATION_ANS_MANAGER_IS_DISTRIBUTED_ENABLED_TEST_0100 + * @tc.name : function isDistributedEnabled(callback: AsyncCallback): void + * @tc.desc : Obtains whether the device supports distributed notification + */ + it('SUB_NOTIFICATION_ANS_MANAGER_IS_DISTRIBUTED_ENABLED_TEST_0100', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_MANAGER_IS_DISTRIBUTED_ENABLED_TEST_0100 START`) + try { + notificationManager.isDistributedEnabled((err, data) => { + if (err) { + console.info(`${TAG} isDistributedEnabled AsyncCallback err: ${err.code}, errMes: ${err.message}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} isDistributedEnabled AsyncCallback success: ${data}`) + expect(data).assertFalse() + done() + } + }) + } catch (err) { + console.info(`${TAG} isDistributedEnabled AsyncCallback errCode: ${err.code}, errMes: ${err.message}`) + expect(false).assertTrue() + done() + } + console.info(`${TAG} SUB_NOTIFICATION_ANS_MANAGER_IS_DISTRIBUTED_ENABLED_TEST_0100 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_MANAGER_IS_DISTRIBUTED_ENABLED_TEST_0200 + * @tc.name : function isDistributedEnabled(): Promise + * @tc.desc : Obtains whether the device supports distributed notification + */ + it('SUB_NOTIFICATION_ANS_MANAGER_IS_DISTRIBUTED_ENABLED_TEST_0200', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_MANAGER_IS_DISTRIBUTED_ENABLED_TEST_0200 START`) + notificationManager.isDistributedEnabled().then((data) => { + console.info(`${TAG} isDistributedEnabled Promise success: ${data}`) + expect(data).assertFalse() + done() + }).catch((err) => { + console.info(`${TAG} isDistributedEnabled Promise err: ${err.code}, errMes: ${err.message}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_MANAGER_IS_DISTRIBUTED_ENABLED_TEST_0200 END`) + }) + + console.info(TAG + 'SUB_NOTIFICATION_IS_DISTRIBUTED_ENABLED_TEST END') + }) + +} diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/test/List.test.js b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/test/List.test.js index 92d4ca2ecbc6bfb2293c4563abd1040452d7f61a..0de16b875e77a6aedece7931d0e589b751fd63d1 100644 --- a/notification/ans_standard/actsNotificationDistributedTest/src/main/js/test/List.test.js +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/js/test/List.test.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 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 @@ -13,6 +13,9 @@ * limitations under the License. */ import ActsNotificationDistributedTest from './ActsNotificationDistributedTest.js' +import ActsNotificationManagerDistributedTest from './ActsNotificationManagerDistributedTest.js' + export default function testsuite() { - ActsNotificationDistributedTest() + ActsNotificationDistributedTest() + ActsNotificationManagerDistributedTest() }