diff options
Diffstat (limited to 'src/components/policy/policy_regular/test/cache_manager_test.cc')
-rw-r--r-- | src/components/policy/policy_regular/test/cache_manager_test.cc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/components/policy/policy_regular/test/cache_manager_test.cc b/src/components/policy/policy_regular/test/cache_manager_test.cc index 5666de03b0..31166b8f43 100644 --- a/src/components/policy/policy_regular/test/cache_manager_test.cc +++ b/src/components/policy/policy_regular/test/cache_manager_test.cc @@ -242,6 +242,51 @@ TEST_F(CacheManagerTest, EXPECT_EQ(0u, notif_number); } +TEST_F(CacheManagerTest, + GetNotificationsNumber_Subtle_FieldNotPresent_UseFallback) { + const std::string string_table( + "{" + "\"policy_table\": {" + "\"module_config\": {" + "\"notifications_per_minute_by_priority\": {" + "\"EMERGENCY\": 1," + "\"NAVIGATION\": 2," + "\"VOICECOM\": 3," + "\"COMMUNICATION\": 4," + "\"NORMAL\": 5," + "\"NONE\": 6" + "}" + "}" + "}" + "}"); + *pt_ = CreateCustomPT(string_table); + + std::string priority = "EMERGENCY"; + uint32_t notif_number = + cache_manager_->GetNotificationsNumber(priority, true); + EXPECT_EQ(1u, notif_number); + + priority = "NAVIGATION"; + notif_number = cache_manager_->GetNotificationsNumber(priority, true); + EXPECT_EQ(2u, notif_number); + + priority = "VOICECOM"; + notif_number = cache_manager_->GetNotificationsNumber(priority, true); + EXPECT_EQ(3u, notif_number); + + priority = "COMMUNICATION"; + notif_number = cache_manager_->GetNotificationsNumber(priority, true); + EXPECT_EQ(4u, notif_number); + + priority = "NORMAL"; + notif_number = cache_manager_->GetNotificationsNumber(priority, true); + EXPECT_EQ(5u, notif_number); + + priority = "NONE"; + notif_number = cache_manager_->GetNotificationsNumber(priority, true); + EXPECT_EQ(6u, notif_number); +} + TEST_F(CacheManagerTest, HeartBeatTimeout_ValueInitialized_ReturnValue) { *pt_->policy_table.app_policies_section.apps[kValidAppId] .heart_beat_timeout_ms = 100u; |