#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "remoting/host/security_key/security_key_message_reader_impl.h"
#include <cstdint>
#include <memory>
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "remoting/host/security_key/security_key_message.h"
#include "remoting/host/setup/test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
const remoting::SecurityKeyMessageType kTestMessageType = …;
const uint32_t kMaxSecurityKeyMessageByteCount = …;
}
namespace remoting {
class SecurityKeyMessageReaderImplTest : public testing::Test { … };
SecurityKeyMessageReaderImplTest::SecurityKeyMessageReaderImplTest()
: … { … }
SecurityKeyMessageReaderImplTest::~SecurityKeyMessageReaderImplTest() = default;
void SecurityKeyMessageReaderImplTest::SetUp() { … }
void SecurityKeyMessageReaderImplTest::RunLoop() { … }
void SecurityKeyMessageReaderImplTest::CloseWriteFileAndRunLoop() { … }
void SecurityKeyMessageReaderImplTest::OnMessage(
std::unique_ptr<SecurityKeyMessage> message) { … }
void SecurityKeyMessageReaderImplTest::OperationComplete() { … }
void SecurityKeyMessageReaderImplTest::WriteMessage(
SecurityKeyMessageType message_type,
const std::string& message_payload) { … }
void SecurityKeyMessageReaderImplTest::WriteData(const char* data, int length) { … }
TEST_F(SecurityKeyMessageReaderImplTest, SingleMessageWithNoPayload) { … }
TEST_F(SecurityKeyMessageReaderImplTest, SingleMessageWithPayload) { … }
TEST_F(SecurityKeyMessageReaderImplTest, SingleMessageViaSingleWrite) { … }
TEST_F(SecurityKeyMessageReaderImplTest, SingleMessageViaMultipleWrites) { … }
TEST_F(SecurityKeyMessageReaderImplTest, SingleMessageWithLargePayload) { … }
TEST_F(SecurityKeyMessageReaderImplTest, EmptyFile) { … }
TEST_F(SecurityKeyMessageReaderImplTest, InvalidMessageLength) { … }
TEST_F(SecurityKeyMessageReaderImplTest, ShortHeader) { … }
TEST_F(SecurityKeyMessageReaderImplTest, ZeroLengthMessage) { … }
TEST_F(SecurityKeyMessageReaderImplTest, MissingControlCode) { … }
TEST_F(SecurityKeyMessageReaderImplTest, MissingPayload) { … }
TEST_F(SecurityKeyMessageReaderImplTest, MultipleMessages) { … }
}