@@ -695,6 +695,64 @@ TEST_F(TestICDManager, TestICDMStayActive)
695
695
EXPECT_EQ (stayActivePromisedMs, 20000UL );
696
696
}
697
697
698
+ #if CHIP_CONFIG_ENABLE_ICD_DSLS
699
+ /* *
700
+ * @brief Test verifies the logic of the ICDManager related to DSLS (Dynamic SIT LIT Support)
701
+ */
702
+ TEST_F (TestICDManager, TestICDMDSLS)
703
+ {
704
+ typedef ICDListener::ICDManagementEvents ICDMEvent;
705
+ ICDNotifier notifier = ICDNotifier::GetInstance ();
706
+
707
+ // Set FeatureMap
708
+ // Configures CIP, UAT, LITS and DSLS to 1
709
+ mICDManager .SetTestFeatureMapValue (0x0F );
710
+
711
+ // Check ICDManager starts in SIT mode if no entries are present
712
+ EXPECT_EQ (ICDConfigurationData::GetInstance ().GetICDMode (), ICDConfigurationData::ICDMode::SIT);
713
+
714
+ // Create table with one fabric
715
+ ICDMonitoringTable table1 (testStorage, kTestFabricIndex1 , kMaxTestClients , &(mKeystore ));
716
+
717
+ // Add an entry to the fabric
718
+ ICDMonitoringEntry entry1 (&(mKeystore ));
719
+ entry1.checkInNodeID = kClientNodeId11 ;
720
+ entry1.monitoredSubject = kClientNodeId12 ;
721
+ EXPECT_EQ (CHIP_NO_ERROR, entry1.SetKey (ByteSpan (kKeyBuffer1a )));
722
+ EXPECT_EQ (CHIP_NO_ERROR, table1.Set (0 , entry1));
723
+
724
+ // Trigger register event after first entry was added
725
+ notifier.NotifyICDManagementEvent (ICDMEvent::kTableUpdated );
726
+
727
+ // Check ICDManager is now in the LIT operating mode
728
+ EXPECT_EQ (ICDConfigurationData::GetInstance ().GetICDMode (), ICDConfigurationData::ICDMode::LIT);
729
+
730
+ // Simulate SIT Mode Request - device must switch to SIT mode even if there is a client registered
731
+ notifier.NotifySITModeRequestNotification ();
732
+
733
+ // Check ICDManager is now in the SIT operating mode
734
+ EXPECT_EQ (ICDConfigurationData::GetInstance ().GetICDMode (), ICDConfigurationData::ICDMode::SIT);
735
+
736
+ // Advance time so active mode interval expires.
737
+ AdvanceClockAndRunEventLoop (ICDConfigurationData::GetInstance ().GetActiveModeDuration () + 1_ms32);
738
+
739
+ // Check ICDManager is still in the SIT operating mode
740
+ EXPECT_EQ (ICDConfigurationData::GetInstance ().GetICDMode (), ICDConfigurationData::ICDMode::SIT);
741
+
742
+ // Withdraw SIT mode
743
+ notifier.NotifySITModeRequestWithdrawal ();
744
+
745
+ // Check ICDManager is now in the LIT operating mode
746
+ EXPECT_EQ (ICDConfigurationData::GetInstance ().GetICDMode (), ICDConfigurationData::ICDMode::LIT);
747
+
748
+ // Advance time so active mode interval expires.
749
+ AdvanceClockAndRunEventLoop (ICDConfigurationData::GetInstance ().GetActiveModeDuration () + 1_ms32);
750
+
751
+ // Check ICDManager is still in the LIT operating mode
752
+ EXPECT_EQ (ICDConfigurationData::GetInstance ().GetICDMode (), ICDConfigurationData::ICDMode::LIT);
753
+ }
754
+ #endif // CHIP_CONFIG_ENABLE_ICD_DSLS
755
+
698
756
#if CHIP_CONFIG_ENABLE_ICD_CIP
699
757
#if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS
700
758
#if CHIP_CONFIG_SUBSCRIPTION_TIMEOUT_RESUMPTION
0 commit comments