Skip to content

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits authored and yunhanw-google committed Oct 11, 2024
1 parent 13d53a6 commit a783ee6
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/app/tests/TestCheckInHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
*/

#include <app/InteractionModelEngine.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/support/Span.h>
#include <pw_unit_test/framework.h>
#include <system/SystemPacketBuffer.h>
#include <app/icd/client/CheckInHandler.h>
#include <app/icd/client/DefaultCheckInDelegate.h>
#include <app/icd/client/DefaultICDClientStorage.h>
#include <app/reporting/tests/MockReportScheduler.h>
#include <app/tests/AppTestContext.h>
#include <app/icd/client/DefaultICDClientStorage.h>
#include <app/icd/client/DefaultCheckInDelegate.h>
#include <app/icd/client/CheckInHandler.h>
#include <crypto/DefaultSessionKeystore.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/support/DefaultStorageKeyAllocator.h>
#include <lib/support/Span.h>
#include <lib/support/TestPersistentStorageDelegate.h>
#include <protocols/secure_channel/CheckinMessage.h>
#include <pw_unit_test/framework.h>
#include <system/SystemPacketBuffer.h>
#include <transport/SessionManager.h>

using namespace chip;
Expand All @@ -52,7 +52,7 @@ class CheckInHandlerWrapper : public chip::app::CheckInHandler
{
public:
CHIP_ERROR ValidateOnMessageReceived(Messaging::ExchangeContext * ec, const PayloadHeader & payloadHeader,
System::PacketBufferHandle && payload)
System::PacketBufferHandle && payload)
{
return OnMessageReceived(ec, payloadHeader, std::move(payload));
}
Expand All @@ -78,19 +78,19 @@ TEST_F(TestCheckInHandler, TestOnMessageReceived)
NodeId nodeIdA = 6666;

ICDClientInfo clientInfoA;
clientInfoA.peer_node = ScopedNodeId(nodeIdA, fabricIdA);
clientInfoA.peer_node = ScopedNodeId(nodeIdA, fabricIdA);
clientInfoA.start_icd_counter = 0;
clientInfoA.offset = 0;
clientInfoA.offset = 0;
EXPECT_EQ(manager.UpdateFabricList(fabricIdA), CHIP_NO_ERROR);
EXPECT_EQ(manager.SetKey(clientInfoA, ByteSpan(kKeyBuffer1)), CHIP_NO_ERROR);
EXPECT_EQ(manager.StoreEntry(clientInfoA), CHIP_NO_ERROR);

FabricIndex fabricIdB = 2;
NodeId nodeIdB = 6667;
NodeId nodeIdB = 6667;

ICDClientInfo clientInfoB;
clientInfoB.peer_node = ScopedNodeId(nodeIdB, fabricIdB);
clientInfoB.offset = 0;
clientInfoB.offset = 0;
EXPECT_EQ(manager.UpdateFabricList(fabricIdB), CHIP_NO_ERROR);
EXPECT_EQ(manager.SetKey(clientInfoB, ByteSpan(kKeyBuffer2)), CHIP_NO_ERROR);
EXPECT_EQ(manager.StoreEntry(clientInfoB), CHIP_NO_ERROR);
Expand All @@ -99,7 +99,7 @@ TEST_F(TestCheckInHandler, TestOnMessageReceived)
payloadHeader.SetExchangeID(0);
payloadHeader.SetMessageType(chip::Protocols::SecureChannel::MsgType::ICD_CheckIn);

uint32_t counter = 1;
uint32_t counter = 1;
System::PacketBufferHandle buffer1 = MessagePacketBuffer::New(chip::Protocols::SecureChannel::CheckinMessage::kMinPayloadSize);
MutableByteSpan output1{ buffer1->Start(), buffer1->MaxDataLength() };
EXPECT_EQ(chip::Protocols::SecureChannel::CheckinMessage::GenerateCheckinMessagePayload(
Expand All @@ -122,10 +122,11 @@ TEST_F(TestCheckInHandler, TestOnMessageReceived)
iterator->Release();
iterator = manager.IterateICDClientInfo();
ASSERT_NE(iterator, nullptr);
EXPECT_EQ(clientInfo1.offset , counter - clientInfoA.start_icd_counter);
EXPECT_EQ(clientInfo1.offset, counter - clientInfoA.start_icd_counter);

//Validate duplicate check-in message handling
chip::System::PacketBufferHandle buffer2 = MessagePacketBuffer::New(chip::Protocols::SecureChannel::CheckinMessage::kMinPayloadSize);
// Validate duplicate check-in message handling
chip::System::PacketBufferHandle buffer2 =
MessagePacketBuffer::New(chip::Protocols::SecureChannel::CheckinMessage::kMinPayloadSize);
MutableByteSpan output2{ buffer2->Start(), buffer2->MaxDataLength() };
EXPECT_EQ(chip::Protocols::SecureChannel::CheckinMessage::GenerateCheckinMessagePayload(
clientInfoA.aes_key_handle, clientInfoA.hmac_key_handle, counter, ByteSpan(), output2),
Expand Down

0 comments on commit a783ee6

Please sign in to comment.