Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yunhanw-google committed Aug 9, 2022
1 parent 958f244 commit 65a17a5
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/app/tests/TestWriteInteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<TestContext *>(apContext);
Expand All @@ -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());
Expand Down Expand Up @@ -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();
Expand All @@ -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<TestContext *>(apContext);
Expand All @@ -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());
Expand Down Expand Up @@ -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();
Expand All @@ -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<TestContext *>(apContext);
Expand All @@ -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());
Expand Down Expand Up @@ -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();
Expand All @@ -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<TestContext *>(apContext);
Expand All @@ -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());
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 65a17a5

Please sign in to comment.