diff --git a/src/app/tests/TestWriteInteraction.cpp b/src/app/tests/TestWriteInteraction.cpp index 4b391175ea86d9..aa96f23b77f75f 100644 --- a/src/app/tests/TestWriteInteraction.cpp +++ b/src/app/tests/TestWriteInteraction.cpp @@ -552,7 +552,7 @@ void TestWriteInteraction::TestWriteRoundtrip(nlTestSuite * apSuite, void * apCo engine->Shutdown(); } -// Write Client sends the write request, and process the unknown message error via OnMessageReceived to close the client. +// Write Client sends a write request, receives an unexpected message type, sends a status response to that. void TestWriteInteraction::TestWriteInvalidMessage1(nlTestSuite * apSuite, void * apContext) { TestContext & ctx = *static_cast(apContext); @@ -576,7 +576,7 @@ void TestWriteInteraction::TestWriteInvalidMessage1(nlTestSuite * apSuite, void NL_TEST_ASSERT(apSuite, callback.mOnSuccessCalled == 0 && callback.mOnErrorCalled == 0 && callback.mOnDoneCalled == 0); ctx.GetLoopback().mSentMessageCount = 0; - ctx.GetLoopback().mNumMessagesToDrop = 3; + ctx.GetLoopback().mNumMessagesToDrop = 1; ctx.GetLoopback().mNumMessagesToAllowBeforeDropping = 1; ctx.GetLoopback().mDroppedMessageCount = 0; err = writeClient.SendWriteRequest(ctx.GetSessionBobToAlice()); @@ -608,7 +608,8 @@ void TestWriteInteraction::TestWriteInvalidMessage1(nlTestSuite * apSuite, void NL_TEST_ASSERT(apSuite, callback.mError == CHIP_ERROR_INVALID_MESSAGE_TYPE); NL_TEST_ASSERT(apSuite, callback.mOnSuccessCalled == 0 && callback.mOnErrorCalled == 1 && callback.mOnDoneCalled == 1); - // Client sents status report with invalid action, server's exchange has been closed, and it would send MRP Ack + // TODO: Check that the server gets the right status. + // Client sents status report with invalid action, server's exchange has been closed, so all it sends is an MRP Ack NL_TEST_ASSERT(apSuite, ctx.GetLoopback().mSentMessageCount == 2); engine->Shutdown(); @@ -618,8 +619,7 @@ void TestWriteInteraction::TestWriteInvalidMessage1(nlTestSuite * apSuite, void ctx.CreateSessionBobToAlice(); } -// Write Client sends the write request, and process the invalid write response message error via OnMessageReceived to close the -// client. +// Write Client sends a write request, receives a malformed write response message, sends a Status Report. void TestWriteInteraction::TestWriteInvalidMessage2(nlTestSuite * apSuite, void * apContext) { TestContext & ctx = *static_cast(apContext); @@ -643,7 +643,7 @@ void TestWriteInteraction::TestWriteInvalidMessage2(nlTestSuite * apSuite, void NL_TEST_ASSERT(apSuite, callback.mOnSuccessCalled == 0 && callback.mOnErrorCalled == 0 && callback.mOnDoneCalled == 0); ctx.GetLoopback().mSentMessageCount = 0; - ctx.GetLoopback().mNumMessagesToDrop = 3; + ctx.GetLoopback().mNumMessagesToDrop = 1; ctx.GetLoopback().mNumMessagesToAllowBeforeDropping = 1; ctx.GetLoopback().mDroppedMessageCount = 0; err = writeClient.SendWriteRequest(ctx.GetSessionBobToAlice()); @@ -675,7 +675,7 @@ void TestWriteInteraction::TestWriteInvalidMessage2(nlTestSuite * apSuite, void NL_TEST_ASSERT(apSuite, callback.mError == CHIP_ERROR_END_OF_TLV); NL_TEST_ASSERT(apSuite, callback.mOnSuccessCalled == 0 && callback.mOnErrorCalled == 1 && callback.mOnDoneCalled == 1); - // Client sents status report with invalid action, server's exchange has been closed, and it would send MRP Ack + // Client sents status report with invalid action, server's exchange has been closed, so all it sends is an MRP Ack NL_TEST_ASSERT(apSuite, ctx.GetLoopback().mSentMessageCount == 2); engine->Shutdown(); @@ -685,8 +685,7 @@ void TestWriteInteraction::TestWriteInvalidMessage2(nlTestSuite * apSuite, void ctx.CreateSessionBobToAlice(); } -// Write Client sends the write request, and process the malformed status response message error via OnMessageReceived to close the -// client. +// Write Client sends a write request, receives a malformed status response message. void TestWriteInteraction::TestWriteInvalidMessage3(nlTestSuite * apSuite, void * apContext) { TestContext & ctx = *static_cast(apContext); @@ -710,7 +709,7 @@ void TestWriteInteraction::TestWriteInvalidMessage3(nlTestSuite * apSuite, void NL_TEST_ASSERT(apSuite, callback.mOnSuccessCalled == 0 && callback.mOnErrorCalled == 0 && callback.mOnDoneCalled == 0); ctx.GetLoopback().mSentMessageCount = 0; - ctx.GetLoopback().mNumMessagesToDrop = 3; + ctx.GetLoopback().mNumMessagesToDrop = 1; ctx.GetLoopback().mNumMessagesToAllowBeforeDropping = 1; ctx.GetLoopback().mDroppedMessageCount = 0; err = writeClient.SendWriteRequest(ctx.GetSessionBobToAlice()); @@ -742,7 +741,8 @@ void TestWriteInteraction::TestWriteInvalidMessage3(nlTestSuite * apSuite, void NL_TEST_ASSERT(apSuite, callback.mError == CHIP_ERROR_END_OF_TLV); NL_TEST_ASSERT(apSuite, callback.mOnSuccessCalled == 0 && callback.mOnErrorCalled == 1 && callback.mOnDoneCalled == 1); - // Client sents status report with invalid action, server's exchange has been closed, and it would send MRP Ack + // TODO: Check that the server gets the right status + // Client sents status report with invalid action, server's exchange has been closed, so all it sends is an MRP ack. NL_TEST_ASSERT(apSuite, ctx.GetLoopback().mSentMessageCount == 2); engine->Shutdown(); @@ -752,8 +752,7 @@ void TestWriteInteraction::TestWriteInvalidMessage3(nlTestSuite * apSuite, void ctx.CreateSessionBobToAlice(); } -// Write Client sends the write request, and process the busy status response message error via OnMessageReceived to close the -// client. +// Write Client sends a write request, receives a busy status response message. void TestWriteInteraction::TestWriteInvalidMessage4(nlTestSuite * apSuite, void * apContext) { TestContext & ctx = *static_cast(apContext); @@ -777,7 +776,7 @@ void TestWriteInteraction::TestWriteInvalidMessage4(nlTestSuite * apSuite, void NL_TEST_ASSERT(apSuite, callback.mOnSuccessCalled == 0 && callback.mOnErrorCalled == 0 && callback.mOnDoneCalled == 0); ctx.GetLoopback().mSentMessageCount = 0; - ctx.GetLoopback().mNumMessagesToDrop = 3; + ctx.GetLoopback().mNumMessagesToDrop = 1; ctx.GetLoopback().mNumMessagesToAllowBeforeDropping = 1; ctx.GetLoopback().mDroppedMessageCount = 0; err = writeClient.SendWriteRequest(ctx.GetSessionBobToAlice()); @@ -810,7 +809,8 @@ void TestWriteInteraction::TestWriteInvalidMessage4(nlTestSuite * apSuite, void NL_TEST_ASSERT(apSuite, callback.mError == CHIP_IM_GLOBAL_STATUS(Busy)); NL_TEST_ASSERT(apSuite, callback.mOnSuccessCalled == 0 && callback.mOnErrorCalled == 1 && callback.mOnDoneCalled == 1); - // Client sents status report with invalid action, server's exchange has been closed, and it would send MRP Ack + // TODO: Check that the server gets the right status.. + // Client sents status report with invalid action, server's exchange has been closed, so it just sends an MRP ack. NL_TEST_ASSERT(apSuite, ctx.GetLoopback().mSentMessageCount == 2); engine->Shutdown();