diff --git a/frameworks/core/test/unittest/ans_manager_proxy_test/ans_manager_proxy_unit_test.cpp b/frameworks/core/test/unittest/ans_manager_proxy_test/ans_manager_proxy_unit_test.cpp index 0ccae5671c95c6b650bfbd2cf4fba676e4bb54ae..a688c6fe3aa8ea2de3c684a0175273a79253d1b3 100644 --- a/frameworks/core/test/unittest/ans_manager_proxy_test/ans_manager_proxy_unit_test.cpp +++ b/frameworks/core/test/unittest/ans_manager_proxy_test/ans_manager_proxy_unit_test.cpp @@ -1541,6 +1541,318 @@ int SendRequestReplaceNotifications(uint32_t code, MessageParcel &data, MessageP return 0; } +/* + * @tc.name: GetSlotFlagsAsBundleTest_0100 + * @tc.desc: test GetSlotFlagsAsBundle function + * @tc.type: FUNC + * @tc.require: #I5XO2O + */ +HWTEST_F(AnsManagerProxyUnitTest, GetSlotFlagsAsBundleTest_0100, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) + << "AnsManagerProxyUnitTest, GetSlotFlagsAsBundleTest_0100, TestSize.Level1"; + MockWriteInterfaceToken(false); + sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); + ASSERT_NE(nullptr, iremoteObject); + std::shared_ptr proxy = std::make_shared(iremoteObject); + ASSERT_NE(nullptr, proxy); + sptr bundleOption = new (std::nothrow) NotificationBundleOption(); + uint32_t soltFlags = 0; + int32_t result = proxy->GetSlotFlagsAsBundle(bundleOption, soltFlags); + EXPECT_EQ(ERR_ANS_PARCELABLE_FAILED, result); +} + +/* + * @tc.name: GetSlotFlagsAsBundleTest_0200 + * @tc.desc: test GetSlotFlagsAsBundle function + * @tc.type: FUNC + * @tc.require: #I5XO2O + */ +HWTEST_F(AnsManagerProxyUnitTest, GetSlotFlagsAsBundleTest_0200, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) + << "AnsManagerProxyUnitTest, GetSlotFlagsAsBundleTest_0200, TestSize.Level1"; + MockWriteInterfaceToken(true); + sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); + ASSERT_NE(nullptr, iremoteObject); + std::shared_ptr proxy = std::make_shared(iremoteObject); + ASSERT_NE(nullptr, proxy); + sptr bundleOption = nullptr; + uint32_t soltFlags = 0; + int32_t result = proxy->GetSlotFlagsAsBundle(bundleOption, soltFlags); + EXPECT_EQ(ERR_ANS_PARCELABLE_FAILED, result); +} + +/* + * @tc.name: GetSlotFlagsAsBundleTest_0300 + * @tc.desc: test GetSlotFlagsAsBundle function + * @tc.type: FUNC + * @tc.require: #I5XO2O + */ +HWTEST_F(AnsManagerProxyUnitTest, GetSlotFlagsAsBundleTest_0300, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) + << "AnsManagerProxyUnitTest, GetSlotFlagsAsBundleTest_0300, TestSize.Level1"; + MockWriteInterfaceToken(true); + sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); + ASSERT_NE(nullptr, iremoteObject); + std::shared_ptr proxy = std::make_shared(iremoteObject); + ASSERT_NE(nullptr, proxy); + sptr bundleOption = nullptr; + uint32_t soltFlags = 0; + int32_t result = proxy->GetSlotFlagsAsBundle(bundleOption, soltFlags); + EXPECT_EQ(ERR_ANS_PARCELABLE_FAILED, result); +} + +/* + * @tc.name: GetSlotFlagsAsBundleTest_0400 + * @tc.desc: test GetSlotFlagsAsBundle function + * @tc.type: FUNC + * @tc.require: #I5XO2O + */ +HWTEST_F(AnsManagerProxyUnitTest, GetSlotFlagsAsBundleTest_0400, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) + << "AnsManagerProxyUnitTest, GetSlotFlagsAsBundleTest_0400, TestSize.Level1"; + sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); + ASSERT_NE(nullptr, iremoteObject); + EXPECT_CALL(*iremoteObject, SendRequest(_, _, _, _)) + .WillRepeatedly(DoAll(Invoke(std::bind(SendRequestReplaceNum, _1, _2, _3, _4, + ERR_OK, true, 1, true)), Return(NO_ERROR))); + std::shared_ptr proxy = std::make_shared(iremoteObject); + ASSERT_NE(nullptr, proxy); + sptr bundleOption = new (std::nothrow) NotificationBundleOption(); + uint32_t soltFlags = 0; + int32_t result = proxy->GetSlotFlagsAsBundle(bundleOption, soltFlags); + EXPECT_EQ(ERR_OK, result); + EXPECT_EQ(ERR_OK, soltFlags); +} + +/* + * @tc.name: GetSlotFlagsAsBundleTest_0500 + * @tc.desc: test GetSlotFlagsAsBundle function + * @tc.type: FUNC + * @tc.require: #I5XO2O + */ +HWTEST_F(AnsManagerProxyUnitTest, GetSlotFlagsAsBundleTest_0500, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) + << "AnsManagerProxyUnitTest, GetSlotFlagsAsBundleTest_0500, TestSize.Level1"; + sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); + ASSERT_NE(nullptr, iremoteObject); + EXPECT_CALL(*iremoteObject, SendRequest(_, _, _, _)).Times(1) + .WillRepeatedly(DoAll(Return(DEAD_OBJECT))); + std::shared_ptr proxy = std::make_shared(iremoteObject); + ASSERT_NE(nullptr, proxy); + sptr bundleOption = new (std::nothrow) NotificationBundleOption(); + uint32_t soltFlags = 0; + int32_t result = proxy->GetSlotFlagsAsBundle(bundleOption, soltFlags); + EXPECT_EQ(ERR_ANS_TRANSACT_FAILED, result); +} + +/* + * @tc.name: GetSlotFlagsAsBundleTest_0600 + * @tc.desc: test GetSlotFlagsAsBundle function + * @tc.type: FUNC + * @tc.require: #I5XO2O + */ +HWTEST_F(AnsManagerProxyUnitTest, GetSlotFlagsAsBundleTest_0600, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) + << "AnsManagerProxyUnitTest, GetSlotFlagsAsBundleTest_0600, TestSize.Level1"; + sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); + ASSERT_NE(nullptr, iremoteObject); + EXPECT_CALL(*iremoteObject, SendRequest(_, _, _, _)).Times(1) + .WillRepeatedly(DoAll(Invoke(std::bind(SendRequestReplaceNum, _1, _2, _3, _4, + ERR_OK, false, 1, true)), Return(NO_ERROR))); + std::shared_ptr proxy = std::make_shared(iremoteObject); + ASSERT_NE(nullptr, proxy); + sptr bundleOption = new (std::nothrow) NotificationBundleOption(); + uint32_t soltFlags = 0; + uint32_t res = 1; + int32_t result = proxy->GetSlotFlagsAsBundle(bundleOption, soltFlags); + EXPECT_EQ(res, result); +} + +/* + * @tc.name: GetSlotFlagsAsBundleTest_0700 + * @tc.desc: test GetSlotFlagsAsBundle function + * @tc.type: FUNC + * @tc.require: #I5XO2O + */ +HWTEST_F(AnsManagerProxyUnitTest, GetSlotFlagsAsBundleTest_0700, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) + << "AnsManagerProxyUnitTest, GetSlotFlagsAsBundleTest_0700, TestSize.Level1"; + sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); + ASSERT_NE(nullptr, iremoteObject); + EXPECT_CALL(*iremoteObject, SendRequest(_, _, _, _)).Times(1) + .WillRepeatedly(DoAll(Invoke(std::bind(SendRequestReplaceNum, _1, _2, _3, _4, + ERR_OK, true, 1, false)), Return(NO_ERROR))); + std::shared_ptr proxy = std::make_shared(iremoteObject); + ASSERT_NE(nullptr, proxy); + sptr bundleOption = new (std::nothrow) NotificationBundleOption(); + uint32_t soltFlags = 0; + int32_t result = proxy->GetSlotFlagsAsBundle(bundleOption, soltFlags); + EXPECT_EQ(ERR_OK, result); +} + +/* + * @tc.name: SetSlotFlagsAsBundleTest_0100 + * @tc.desc: test SetSlotFlagsAsBundle function + * @tc.type: FUNC + * @tc.require: #I5XO2O + */ +HWTEST_F(AnsManagerProxyUnitTest, SetSlotFlagsAsBundleTest_0100, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) + << "AnsManagerProxyUnitTest, SetSlotFlagsAsBundleTest_0100, TestSize.Level1"; + MockWriteInterfaceToken(false); + sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); + ASSERT_NE(nullptr, iremoteObject); + std::shared_ptr proxy = std::make_shared(iremoteObject); + ASSERT_NE(nullptr, proxy); + sptr bundleOption = new (std::nothrow) NotificationBundleOption(); + uint32_t soltFlags = 0; + int32_t result = proxy->SetSlotFlagsAsBundle(bundleOption, soltFlags); + EXPECT_EQ(ERR_ANS_PARCELABLE_FAILED, result); +} + +/* + * @tc.name: SetSlotFlagsAsBundleTest_0200 + * @tc.desc: test SetSlotFlagsAsBundle function + * @tc.type: FUNC + * @tc.require: #I5XO2O + */ +HWTEST_F(AnsManagerProxyUnitTest, SetSlotFlagsAsBundleTest_0200, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) + << "AnsManagerProxyUnitTest, SetSlotFlagsAsBundleTest_0200, TestSize.Level1"; + MockWriteInterfaceToken(true); + sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); + ASSERT_NE(nullptr, iremoteObject); + std::shared_ptr proxy = std::make_shared(iremoteObject); + ASSERT_NE(nullptr, proxy); + sptr bundleOption = nullptr; + uint32_t soltFlags = 0; + int32_t result = proxy->SetSlotFlagsAsBundle(bundleOption, soltFlags); + EXPECT_EQ(ERR_ANS_PARCELABLE_FAILED, result); +} + +/* + * @tc.name: SetSlotFlagsAsBundleTest_0300 + * @tc.desc: test SetSlotFlagsAsBundle function + * @tc.type: FUNC + * @tc.require: #I5XO2O + */ +HWTEST_F(AnsManagerProxyUnitTest, SetSlotFlagsAsBundleTest_0300, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) + << "AnsManagerProxyUnitTest, GetSlotFlagsAsBundleTest_0300, TestSize.Level1"; + MockWriteInterfaceToken(true); + sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); + ASSERT_NE(nullptr, iremoteObject); + std::shared_ptr proxy = std::make_shared(iremoteObject); + ASSERT_NE(nullptr, proxy); + sptr bundleOption = nullptr; + uint32_t soltFlags = 0; + int32_t result = proxy->SetSlotFlagsAsBundle(bundleOption, soltFlags); + EXPECT_EQ(ERR_ANS_PARCELABLE_FAILED, result); +} + +/* + * @tc.name: SetSlotFlagsAsBundleTest_0400 + * @tc.desc: test SetSlotFlagsAsBundle function + * @tc.type: FUNC + * @tc.require: #I5XO2O + */ +HWTEST_F(AnsManagerProxyUnitTest, SetSlotFlagsAsBundleTest_0400, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) + << "AnsManagerProxyUnitTest, SetSlotFlagsAsBundleTest_0400, TestSize.Level1"; + sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); + ASSERT_NE(nullptr, iremoteObject); + EXPECT_CALL(*iremoteObject, SendRequest(_, _, _, _)) + .WillRepeatedly(DoAll(Invoke(std::bind(SendRequestReplaceNum, _1, _2, _3, _4, + ERR_OK, true, 1, true)), Return(NO_ERROR))); + std::shared_ptr proxy = std::make_shared(iremoteObject); + ASSERT_NE(nullptr, proxy); + sptr bundleOption = new (std::nothrow) NotificationBundleOption(); + uint32_t soltFlags = 0; + int32_t result = proxy->SetSlotFlagsAsBundle(bundleOption, soltFlags); + EXPECT_EQ(ERR_OK, result); + EXPECT_EQ(ERR_OK, soltFlags); +} + +/* + * @tc.name: SetSlotFlagsAsBundleTest_0500 + * @tc.desc: test SetSlotFlagsAsBundle function + * @tc.type: FUNC + * @tc.require: #I5XO2O + */ +HWTEST_F(AnsManagerProxyUnitTest, SetSlotFlagsAsBundleTest_0500, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) + << "AnsManagerProxyUnitTest, SetSlotFlagsAsBundleTest_0500, TestSize.Level1"; + sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); + ASSERT_NE(nullptr, iremoteObject); + EXPECT_CALL(*iremoteObject, SendRequest(_, _, _, _)).Times(1) + .WillRepeatedly(DoAll(Return(DEAD_OBJECT))); + std::shared_ptr proxy = std::make_shared(iremoteObject); + ASSERT_NE(nullptr, proxy); + sptr bundleOption = new (std::nothrow) NotificationBundleOption(); + uint32_t soltFlags = 0; + int32_t result = proxy->SetSlotFlagsAsBundle(bundleOption, soltFlags); + EXPECT_EQ(ERR_ANS_TRANSACT_FAILED, result); +} + +/* + * @tc.name: SetSlotFlagsAsBundleTest_0600 + * @tc.desc: test SetSlotFlagsAsBundle function + * @tc.type: FUNC + * @tc.require: #I5XO2O + */ +HWTEST_F(AnsManagerProxyUnitTest, SetSlotFlagsAsBundleTest_0600, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) + << "AnsManagerProxyUnitTest, GetSlotFlagsAsBundleTest_0600, TestSize.Level1"; + sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); + ASSERT_NE(nullptr, iremoteObject); + EXPECT_CALL(*iremoteObject, SendRequest(_, _, _, _)).Times(1) + .WillRepeatedly(DoAll(Invoke(std::bind(SendRequestReplaceNum, _1, _2, _3, _4, + ERR_OK, false, 1, true)), Return(NO_ERROR))); + std::shared_ptr proxy = std::make_shared(iremoteObject); + ASSERT_NE(nullptr, proxy); + sptr bundleOption = new (std::nothrow) NotificationBundleOption(); + uint32_t soltFlags = 0; + uint32_t res = 1; + int32_t result = proxy->SetSlotFlagsAsBundle(bundleOption, soltFlags); + EXPECT_EQ(res, result); +} + +/* + * @tc.name: SetSlotFlagsAsBundleTest_0700 + * @tc.desc: test SetSlotFlagsAsBundle function + * @tc.type: FUNC + * @tc.require: #I5XO2O + */ +HWTEST_F(AnsManagerProxyUnitTest, SetSlotFlagsAsBundleTest_0700, Function | MediumTest | Level1) +{ + GTEST_LOG_(INFO) + << "AnsManagerProxyUnitTest, SetSlotFlagsAsBundleTest_0700, TestSize.Level1"; + sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); + ASSERT_NE(nullptr, iremoteObject); + EXPECT_CALL(*iremoteObject, SendRequest(_, _, _, _)).Times(1) + .WillRepeatedly(DoAll(Invoke(std::bind(SendRequestReplaceNum, _1, _2, _3, _4, + ERR_OK, true, 1, false)), Return(NO_ERROR))); + std::shared_ptr proxy = std::make_shared(iremoteObject); + ASSERT_NE(nullptr, proxy); + sptr bundleOption = new (std::nothrow) NotificationBundleOption(); + uint32_t soltFlags = 0; + int32_t result = proxy->SetSlotFlagsAsBundle(bundleOption, soltFlags); + EXPECT_EQ(ERR_OK, result); +} + /* * @tc.name: GetActiveNotificationsTest_0100 * @tc.desc: test GetActiveNotifications function diff --git a/frameworks/core/test/unittest/ans_manager_stub_test/ans_manager_stub_test.cpp b/frameworks/core/test/unittest/ans_manager_stub_test/ans_manager_stub_test.cpp index ecaafd0a77221775f062781b4307966f01434816..eaf77a5b208237bc189c0ee9d0bc9eeeda5a1680 100644 --- a/frameworks/core/test/unittest/ans_manager_stub_test/ans_manager_stub_test.cpp +++ b/frameworks/core/test/unittest/ans_manager_stub_test/ans_manager_stub_test.cpp @@ -4278,5 +4278,91 @@ HWTEST_F(AnsManagerStubTest, HandleRegisterPushCallback01, Function | SmallTest ErrCode ret = ansManagerStub_->HandleRegisterPushCallback(data, reply); EXPECT_EQ(ret, (int)ERR_ANS_PARCELABLE_FAILED); } + +/** + * @tc.name: HandleGetSlotFlagsAsBundle01 + * @tc.desc: Test HandleGetSlotFlagsAsBundle succeeds. + * @tc.type: FUNC + * @tc.require: issueI5XQ4E + */ +HWTEST_F(AnsManagerStubTest, HandleGetSlotFlagsAsBundle01, Function | SmallTest | Level1) +{ + uint32_t code = static_cast(NotificationInterfaceCode::GET_SLOTFLAGS_BY_BUNDLE); + MessageParcel data; + MessageParcel reply; + MessageOption option = {MessageOption::TF_SYNC}; + uint32_t res = 305; + + sptr bundleOption = new NotificationBundleOption(); + + data.WriteInterfaceToken(AnsManagerStub::GetDescriptor()); + data.WriteStrongParcelable(bundleOption); + + ErrCode ret = ansManagerStub_->OnRemoteRequest(code, data, reply, option); + EXPECT_EQ((int)ret, (int)res); +} + +/** + * @tc.name: HandleGetSlotFlagsAsBundle02 + * @tc.desc: Test if the bundleOption in data is null. + * @tc.type: FUNC + * @tc.require: issueI5XQ4E + */ +HWTEST_F(AnsManagerStubTest, HandleGetSlotFlagsAsBundle02, Function | SmallTest | Level1) +{ + uint32_t code = static_cast(NotificationInterfaceCode::GET_SLOTFLAGS_BY_BUNDLE); + MessageParcel data; + MessageParcel reply; + MessageOption option = {MessageOption::TF_SYNC}; + uint32_t res = 305; + + data.WriteInterfaceToken(AnsManagerStub::GetDescriptor()); + + ErrCode ret = ansManagerStub_->OnRemoteRequest(code, data, reply, option); + EXPECT_EQ((int)ret, (int)res); +} + +/** + * @tc.name: HandleSetSlotFlagsAsBundle01 + * @tc.desc: Test HandleSetSlotFlagsAsBundle succeeds. + * @tc.type: FUNC + * @tc.require: issueI5XQ4E + */ +HWTEST_F(AnsManagerStubTest, HandleSetSlotFlagsAsBundle01, Function | SmallTest | Level1) +{ + uint32_t code = static_cast(NotificationInterfaceCode::SET_SLOTFLAGS_BY_BUNDLE); + MessageParcel data; + MessageParcel reply; + MessageOption option = {MessageOption::TF_SYNC}; + uint32_t res = 305; + + sptr bundleOption = new NotificationBundleOption(); + + data.WriteInterfaceToken(AnsManagerStub::GetDescriptor()); + data.WriteStrongParcelable(bundleOption); + + ErrCode ret = ansManagerStub_->OnRemoteRequest(code, data, reply, option); + EXPECT_EQ((int)ret, (int)res); +} + +/** + * @tc.name: HandleSetSlotFlagsAsBundle02 + * @tc.desc: Test if the bundleOption in data is null. + * @tc.type: FUNC + * @tc.require: issueI5XQ4E + */ +HWTEST_F(AnsManagerStubTest, HandleSetSlotFlagsAsBundle02, Function | SmallTest | Level1) +{ + uint32_t code = static_cast(NotificationInterfaceCode::SET_SLOTFLAGS_BY_BUNDLE); + MessageParcel data; + MessageParcel reply; + MessageOption option = {MessageOption::TF_SYNC}; + uint32_t res = 305; + + data.WriteInterfaceToken(AnsManagerStub::GetDescriptor()); + + ErrCode ret = ansManagerStub_->OnRemoteRequest(code, data, reply, option); + EXPECT_EQ((int)ret, (int)res); +} } } diff --git a/services/ans/test/unittest/BUILD.gn b/services/ans/test/unittest/BUILD.gn index bdd6aa49089d717000e49c72d60f5027c4bc4b21..c2b3befab46d14e64d3937a860b12e555791f409 100644 --- a/services/ans/test/unittest/BUILD.gn +++ b/services/ans/test/unittest/BUILD.gn @@ -786,6 +786,51 @@ ohos_unittest("notification_rdb_data_mgr_test") { part_name = "${component_name}" } +ohos_unittest("notification_config_parse_test") { + module_out_path = module_output_path + include_dirs = [ + ".", + "include", + "/${services_path}/ans/include", + "${services_path}/ans/test/unittest/mock/include", + ] + + sources = [ "notification_config_parse_test.cpp" ] + + deps = [ + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:libans", + "//third_party/googletest:gtest_main", + "//third_party/libxml2:libxml2", + ] + + external_deps = [ + "ability_base:want", + "ability_base:zuri", + "ability_runtime:abilitykit_native", + "ability_runtime:app_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "eventhandler:libeventhandler", + "hilog:libhilog", + "hitrace:hitrace_meter", + "hitrace:libhitracechain", + "image_framework:image_native", + "ipc:ipc_core", + "kv_store:distributeddata_inner", + "os_account:os_account_innerkits", + "player_framework:media_client", + "relational_store:native_rdb", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + "time_service:time_client", + ] +} + group("unittest") { testonly = true deps = [ @@ -793,6 +838,7 @@ group("unittest") { ":advanced_notification_service_branch_test", ":ans_unit_test", ":bundle_manager_helper_branch_test", + ":notification_config_parse_test", ":notification_dialog_test", ":notification_preferences_database_branch_test", ":notification_preferences_test", diff --git a/services/ans/test/unittest/notification_config_parse_test.cpp b/services/ans/test/unittest/notification_config_parse_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3f05edcfec8196cb0cb8e077ea35ca9b6232a0ab --- /dev/null +++ b/services/ans/test/unittest/notification_config_parse_test.cpp @@ -0,0 +1,74 @@ +/* + * 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. + */ + +#include "notification_config_parse.h" +#include + +using namespace testing::ext; +namespace OHOS { +namespace Notification { + +class NotificationConfigFileTest : public testing::Test { +public: + NotificationConfigFileTest() + {} + ~NotificationConfigFileTest() + {} + + static void SetUpTestCas(void); + static void TearDownTestCase(void); + void SetUp(); + void TearDown(); +}; + +void NotificationConfigFileTest::SetUpTestCas(void) +{} + +void NotificationConfigFileTest::TearDownTestCase(void) +{} + +void NotificationConfigFileTest::SetUp(void) +{} + +void NotificationConfigFileTest::TearDown(void) +{} + +/** + * @tc.name: parseNotificationConfigCcmFileTest_001 + * @tc.desc: parseNotificationConfigCcmFile Test + * @tc.type: FUNC + * @tc.require: issueNumber + */ +HWTEST_F(NotificationConfigFileTest, parseNotificationConfigCcmFileTest_001, TestSize.Level1) +{ + std::string filepath = nullptr; + std::map slotFlagsMap; + EXPECT_EQ(NotificationConfigFile::parseNotificationConfigCcmFile(filepath, slotFlagsMap), false); +} + +/** + * @tc.name: getNotificationSlotFlagConfigTest_001 + * @tc.desc: getNotificationSlotFlagConfig Test + * @tc.type: FUNC + * @tc.require: issueNumber + */ +HWTEST_F(NotificationConfigFileTest, getNotificationSlotFlagConfigTest_001, TestSize.Level1) +{ + std::string filepath = nullptr; + std::map slotFlagsMap; + EXPECT_EQ(NotificationConfigFile::getNotificationSlotFlagConfig(filepath, slotFlagsMap), true); +} +} //namespace Notification +} //namespace OHOS \ No newline at end of file diff --git a/services/ans/test/unittest/notification_preferences_database_branch_test/notification_preferences_database_branch_test.cpp b/services/ans/test/unittest/notification_preferences_database_branch_test/notification_preferences_database_branch_test.cpp index f8d43528ddcfd2f407f656c1394687ea24ecec0e..e16ab3418808bfb0f20b845795b081ccabfdf0b1 100755 --- a/services/ans/test/unittest/notification_preferences_database_branch_test/notification_preferences_database_branch_test.cpp +++ b/services/ans/test/unittest/notification_preferences_database_branch_test/notification_preferences_database_branch_test.cpp @@ -990,5 +990,16 @@ HWTEST_F(NotificationPreferencesDatabaseBranchTest, NotificationPreferences_0570 MockDeleteData(true); EXPECT_EQ(preferncesDB_->DeleteKvFromDb(string("test")), NativeRdb::E_OK); } + +/** + * @tc.name : PutSlotFlags_00100 + * @tc.number : + * @tc.desc : Put bundle total badge nums into disturbe DB, return is true. + */ +HWTEST_F(NotificationPreferencesDatabaseBranchTest, PutSlotFlags_00100, Function | SmallTest | Level1) +{ + NotificationPreferencesInfo::BundleInfo bundleInfo; + EXPECT_EQ(preferncesDB_->PutSlotFlags(bundleInfo, 0), true); +} } // namespace Notification } // namespace OHOS