chromium/services/device/serial/serial_io_handler_posix_unittest.cc

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "services/device/serial/serial_io_handler_posix.h"

#include "testing/gtest/include/gtest/gtest.h"

namespace device {

class SerialIoHandlerPosixTest : public testing::Test {};

// 'a' 'b' 'c'
TEST_F(SerialIoHandlerPosixTest, NoErrorReadOnce) {}

// 'a' 'b'
// 'c'
TEST_F(SerialIoHandlerPosixTest, NoErrorReadTwiceBytesReadTwoAndOne) {}

// 'a'
// 'b' c'
TEST_F(SerialIoHandlerPosixTest, NoErrorReadTwiceBytesReadOneAndTwo) {}

// 'a'
// 'b'
// 'c'
TEST_F(SerialIoHandlerPosixTest, NoErrorReadThreeTimes) {}

// '\377' '\0' '\0'
TEST_F(SerialIoHandlerPosixTest, BreakReadOnce) {}

// 'a' 'b' '\377' '\0' '\0' 'c' 'd' 'e'
TEST_F(SerialIoHandlerPosixTest, BreakReadOnceHasBytesBeforeAndAfterBreak) {}

// '\377' '\0'
// '\0'
TEST_F(SerialIoHandlerPosixTest, BreakReadTwiceBytesReadTwoAndOne) {}

// 'a' 'b' 'c' '\377' '\0'
// '\0' 'd' 'e'
TEST_F(SerialIoHandlerPosixTest,
       BreakReadTwiceBytesReadTwoAndOneHasBytesBeforeAndAfterBreak) {}

// '\377'
// '\0' '\0'
TEST_F(SerialIoHandlerPosixTest, BreakReadTwiceBytesReadOneAndTwo) {}

// 'a' 'b' '\377'
// '\0' '\0' 'c'
TEST_F(SerialIoHandlerPosixTest,
       BreakReadTwiceBytesReadOneAndTwoHasBytesBeforeAndAfterBreak) {}

// '\377'
// '\0'
// '\0'
TEST_F(SerialIoHandlerPosixTest, BreakReadThreeTimes) {}

// 'a' '\377'
// '\0'
// '\0' 'b'
TEST_F(SerialIoHandlerPosixTest,
       BreakReadThreeTimesHasBytesBeforeAndAfterBreak) {}

// '\377' '\0' 'a'
TEST_F(SerialIoHandlerPosixTest, ParityErrorReadOnce) {}

// 'b' 'c' '\377' '\0' 'a' 'd'
TEST_F(SerialIoHandlerPosixTest,
       ParityErrorReadOnceHasBytesBeforeAndAfterParityError) {}

// '\377' '\0'
// 'a'
TEST_F(SerialIoHandlerPosixTest, ParityErrorReadTwiceBytesReadTwoAndOne) {}

// 'b' '\377' '\0'
// 'a' 'c' 'd'
TEST_F(
    SerialIoHandlerPosixTest,
    ParityErrorReadTwiceBytesReadTwoAndOneHasBytesBeforeAndAfterParityError) {}

// '\377'
// '\0' 'a'
TEST_F(SerialIoHandlerPosixTest, ParityErrorReadTwiceBytesReadOneAndTwo) {}

// 'b' 'c' '\377'
// '\0' 'a' 'd'
TEST_F(
    SerialIoHandlerPosixTest,
    ParityErrorReadTwiceBytesReadOneAndTwoHasBytesBeforeAndAfterParityError) {}

// '\377'
// '\0'
// 'a'
TEST_F(SerialIoHandlerPosixTest, ParityErrorReadThreeTimes) {}

// 'b' '\377'
// '\0'
// 'a' 'c'
TEST_F(SerialIoHandlerPosixTest,
       ParityErrorReadThreeTimesHasBytesBeforeAndAfterParityError) {}

// '\377' '\377'
TEST_F(SerialIoHandlerPosixTest, TwoEOFsReadOnce) {}

// 'a' '\377' '\377' 'b' 'c'
TEST_F(SerialIoHandlerPosixTest, TwoEOFsReadOnceHasBytesBeforeAndAfterEOF) {}

// '\377'
// '\377'
TEST_F(SerialIoHandlerPosixTest, TwoEOFsReadTwice) {}

// 'a' '\377'
// '\377' 'b'
TEST_F(SerialIoHandlerPosixTest, TwoEOFsReadTwiceHasBytesBeforeAndAfterEOF) {}

// '\377' '\0' 'a'
TEST_F(SerialIoHandlerPosixTest, ParityCheckDisabledReadOnce) {}

// 'b' '\377' '\0' 'a' 'c'
TEST_F(SerialIoHandlerPosixTest,
       ParityCheckDisabledReadOnceHasBytesBeforeAndAfter) {}

// '\377' '\0'
// 'a'
TEST_F(SerialIoHandlerPosixTest,
       ParityCheckDisabledReadTwiceBytesReadTwoAndOne) {}

// '\377' '\0'
// 'a' 'b'
TEST_F(SerialIoHandlerPosixTest,
       ParityCheckDisabledReadTwiceBytesReadTwoAndOneHasBytesAfter) {}

// '\377' '\0'
// 'a'
TEST_F(SerialIoHandlerPosixTest,
       ParityCheckDisabledReadTwiceBytesReadTwoAndOneLargerBufferLen) {}

// 'b' '\377' '\0'
// 'a' 'c'
TEST_F(
    SerialIoHandlerPosixTest,
    ParityCheckDisabledReadTwiceBytesReadTwoAndOneBufferLenThreeHasBytesBeforeAndAfter) {}

// 'b' '\377' '\0'
// 'a' 'c'
TEST_F(
    SerialIoHandlerPosixTest,
    ParityCheckDisabledReadTwiceBytesReadTwoAndOneLargerBufferLenHasBytesBeforeAndAfter) {}

// '\377'
// '\0' 'a'
TEST_F(SerialIoHandlerPosixTest,
       ParityCheckDisabledReadTwiceBytesReadOneAndTwo) {}

// 'b' '\377'
// '\0' 'a'
TEST_F(SerialIoHandlerPosixTest,
       ParityCheckDisabledReadTwiceBytesReadOneAndTwoHasBytesBefore) {}

// '\377'
// '\0' 'a'
TEST_F(SerialIoHandlerPosixTest,
       ParityCheckDisabledReadTwiceBytesReadOneAndTwoLargerBufferLen) {}

// 'b' '\377'
// '\0' 'a' 'c'
TEST_F(
    SerialIoHandlerPosixTest,
    ParityCheckDisabledReadTwiceBytesReadOneAndTwoBufferLenThreeHasBytesBeforeAndAfter) {}

// 'b' '\377'
// '\0' 'a' 'c'
TEST_F(
    SerialIoHandlerPosixTest,
    ParityCheckDisabledReadTwiceBytesReadOneAndTwoLargerBufferLenHasBytesBeforeAndAfter) {}

// '\377'
// '\0'
// 'a'
TEST_F(SerialIoHandlerPosixTest,
       ParityCheckDisabledReadThreeTimesBufferLenOne) {}

// '\377'
// '\0'
// 'a'
TEST_F(SerialIoHandlerPosixTest,
       ParityCheckDisabledReadThreeTimesBufferLenTwo) {}

// '\377'
// '\0'
// 'a'
TEST_F(SerialIoHandlerPosixTest,
       ParityCheckDisabledReadThreeTimesLargerBufferLen) {}

// 'b' '\377'
// '\0'
// 'a' 'c'
TEST_F(SerialIoHandlerPosixTest,
       ParityCheckDisabledReadThreeTimesBufferLenThreeByteBeforeAndAfter) {}

// 'b' '\377'
// '\0'
// 'a' 'c'
TEST_F(SerialIoHandlerPosixTest,
       ParityCheckDisabledReadThreeTimesLargerBufferLenHasBytesBeforeAndAfter) {}

TEST_F(SerialIoHandlerPosixTest, BytesReadZero) {}

// '\377' 'a' 'b'
TEST_F(SerialIoHandlerPosixTest, InvalidSequenceReadOnce) {}

// '\377' 'a'
// 'b'
TEST_F(SerialIoHandlerPosixTest, InvalidSequenceReadTwiceBytesReadTwoAndOne) {}

// '\377'
// 'a' 'b'
TEST_F(SerialIoHandlerPosixTest, InvalidSequenceReadTwiceBytesReadOneAndTwo) {}

// '\377'
// 'a' 'b'
TEST_F(SerialIoHandlerPosixTest,
       InvalidSequenceReadTwiceBytesReadOneAndTwoLargerBufferLen) {}

// '\377'
// 'a'
// 'b'
TEST_F(SerialIoHandlerPosixTest, InvalidSequenceReadThreeTimes) {}

// '\377'
// 'a'
// 'b'
TEST_F(SerialIoHandlerPosixTest, InvalidSequenceReadThreeTimesLargerBufferLen) {}

// 'a' 'b' 'c' '\377'
TEST_F(SerialIoHandlerPosixTest, CharsStashedPreset) {}

// 'b' 'c' '\377' '\0' '\0' '\377' '\377' '\377' '\0' 'a' 'd' 'e'
TEST_F(SerialIoHandlerPosixTest, BreakAndEOFAndParityError) {}

// 'b' 'c' '\377' '\0' '\0' '\377'
// '\377' '\377' '\0'
// 'a' 'd' 'e'
TEST_F(SerialIoHandlerPosixTest, BreakAndEOFAndParityErrorReadThreeTimes) {}

}  // namespace device