@@ -704,8 +704,10 @@ TEST_F(TestReliableMessageProtocol, CheckResendApplicationMessageWithPeerExchang
704704 EXPECT_EQ (rm->TestGetCountRetransTable (), 0 );
705705 EXPECT_TRUE (mockReceiver.IsOnMessageReceivedCalled );
706706
707- err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest);
707+ Messaging::UnsolicitedMessageHandler * removedHandler = nullptr ;
708+ err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest, &removedHandler);
708709 EXPECT_EQ (err, CHIP_NO_ERROR);
710+ EXPECT_EQ (removedHandler, &mockReceiver);
709711}
710712
711713TEST_F (TestReliableMessageProtocol, CheckDuplicateMessageClosedExchange)
@@ -757,8 +759,10 @@ TEST_F(TestReliableMessageProtocol, CheckDuplicateMessageClosedExchange)
757759 // Let's not drop the duplicate message
758760 mockReceiver.SetDropAckResponse (false );
759761
760- err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest);
762+ Messaging::UnsolicitedMessageHandler * removedHandler = nullptr ;
763+ err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest, &removedHandler);
761764 EXPECT_EQ (err, CHIP_NO_ERROR);
765+ EXPECT_EQ (removedHandler, &mockReceiver);
762766
763767 // Wait for the first re-transmit and ack (should take 64ms)
764768 GetIOContext ().DriveIOUntil (1000_ms32, [&] { return loopback.mSentMessageCount >= 3 ; });
@@ -849,8 +853,10 @@ TEST_F(TestReliableMessageProtocol, CheckDuplicateOldMessageClosedExchange)
849853 // Let's not drop the duplicate message's ack.
850854 mockReceiver.SetDropAckResponse (false );
851855
852- err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest);
856+ Messaging::UnsolicitedMessageHandler * removedHandler = nullptr ;
857+ err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest, &removedHandler);
853858 EXPECT_EQ (err, CHIP_NO_ERROR);
859+ EXPECT_EQ (removedHandler, &mockReceiver);
854860
855861 // Wait for the first re-transmit and ack (should take 64ms)
856862 rm->StartTimer ();
@@ -914,8 +920,10 @@ TEST_F(TestReliableMessageProtocol, CheckResendSessionEstablishmentMessageWithPe
914920 EXPECT_EQ (rm->TestGetCountRetransTable (), 0 );
915921 EXPECT_TRUE (mockReceiver.IsOnMessageReceivedCalled );
916922
917- err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest);
923+ Messaging::UnsolicitedMessageHandler * removedHandler = nullptr ;
924+ err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest, &removedHandler);
918925 EXPECT_EQ (err, CHIP_NO_ERROR);
926+ EXPECT_EQ (removedHandler, &mockReceiver);
919927}
920928
921929TEST_F (TestReliableMessageProtocol, CheckDuplicateMessage)
@@ -964,8 +972,10 @@ TEST_F(TestReliableMessageProtocol, CheckDuplicateMessage)
964972 EXPECT_EQ (loopback.mDroppedMessageCount , 0u );
965973 EXPECT_EQ (rm->TestGetCountRetransTable (), 1 );
966974
967- err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest);
975+ Messaging::UnsolicitedMessageHandler * removedHandler = nullptr ;
976+ err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest, &removedHandler);
968977 EXPECT_EQ (err, CHIP_NO_ERROR);
978+ EXPECT_EQ (removedHandler, &mockReceiver);
969979
970980 // Let's not drop the duplicate message
971981 mockReceiver.SetDropAckResponse (false );
@@ -1062,8 +1072,10 @@ TEST_F(TestReliableMessageProtocol, CheckReceiveAfterStandaloneAck)
10621072 // Ensure that we have received that response.
10631073 EXPECT_TRUE (mockSender.IsOnMessageReceivedCalled );
10641074
1065- err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest);
1075+ Messaging::UnsolicitedMessageHandler * removedHandler = nullptr ;
1076+ err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest, &removedHandler);
10661077 EXPECT_EQ (err, CHIP_NO_ERROR);
1078+ EXPECT_EQ (removedHandler, &mockReceiver);
10671079
10681080 EXPECT_EQ (rm->TestGetCountRetransTable (), 0 );
10691081}
@@ -1187,8 +1199,10 @@ TEST_F(TestReliableMessageProtocol, CheckPiggybackAfterPiggyback)
11871199 EXPECT_TRUE (mockSender.IsOnMessageReceivedCalled );
11881200 EXPECT_TRUE (mockSender.mReceivedPiggybackAck );
11891201
1190- err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest);
1202+ Messaging::UnsolicitedMessageHandler * removedHandler = nullptr ;
1203+ err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest, &removedHandler);
11911204 EXPECT_EQ (err, CHIP_NO_ERROR);
1205+ EXPECT_EQ (removedHandler, &mockReceiver);
11921206
11931207 EXPECT_EQ (rm->TestGetCountRetransTable (), 0 );
11941208}
@@ -1371,8 +1385,10 @@ TEST_F(TestReliableMessageProtocol, CheckMessageAfterClosed)
13711385 // immediately on the receiver, due to the exchange being closed.
13721386 EXPECT_EQ (rm->TestGetCountRetransTable (), 0 );
13731387
1374- err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest);
1388+ Messaging::UnsolicitedMessageHandler * removedHandler = nullptr ;
1389+ err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest, &removedHandler);
13751390 EXPECT_EQ (err, CHIP_NO_ERROR);
1391+ EXPECT_EQ (removedHandler, &mockReceiver);
13761392
13771393 EXPECT_EQ (rm->TestGetCountRetransTable (), 0 );
13781394}
@@ -1926,8 +1942,10 @@ TEST_F(TestReliableMessageProtocol, CheckApplicationResponseDelayed)
19261942 err = CreateSessionAliceToBob ();
19271943 EXPECT_EQ (err, CHIP_NO_ERROR);
19281944
1929- err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest);
1945+ Messaging::UnsolicitedMessageHandler * removedHandler = nullptr ;
1946+ err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest, &removedHandler);
19301947 EXPECT_EQ (err, CHIP_NO_ERROR);
1948+ EXPECT_EQ (removedHandler, &mockReceiver);
19311949}
19321950
19331951TEST_F (TestReliableMessageProtocol, CheckApplicationResponseNeverComes)
@@ -2048,8 +2066,10 @@ TEST_F(TestReliableMessageProtocol, CheckApplicationResponseNeverComes)
20482066 err = CreateSessionAliceToBob ();
20492067 EXPECT_EQ (err, CHIP_NO_ERROR);
20502068
2051- err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest);
2069+ Messaging::UnsolicitedMessageHandler * removedHandler = nullptr ;
2070+ err = GetExchangeManager ().UnregisterUnsolicitedMessageHandlerForType (Echo::MsgType::EchoRequest, &removedHandler);
20522071 EXPECT_EQ (err, CHIP_NO_ERROR);
2072+ EXPECT_EQ (removedHandler, &mockReceiver);
20532073}
20542074
20552075#if CHIP_CONFIG_MRP_ANALYTICS_ENABLED
0 commit comments