#include "third_party/blink/renderer/platform/image-decoders/segment_stream.h"
#include "base/memory/scoped_refptr.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/image-decoders/segment_reader.h"
#include "third_party/blink/renderer/platform/wtf/shared_buffer.h"
namespace blink {
namespace {
constexpr size_t kBufferAllocationSize = …;
constexpr size_t kInsideBufferPosition = …;
constexpr size_t kPastEndOfBufferPosition = …;
::testing::AssertionResult IsCleared(const SegmentStream&);
::testing::AssertionResult IsAtEnd(const SegmentStream&);
::testing::AssertionResult PositionIsZero(const SegmentStream&);
::testing::AssertionResult PositionIsInsideBuffer(const SegmentStream&);
::testing::AssertionResult PositionIsAtEndOfBuffer(const SegmentStream&);
::testing::AssertionResult LengthIsZero(const SegmentStream&);
::testing::AssertionResult LengthIsAllocationSize(const SegmentStream&);
SegmentStream CreatePopulatedSegmentStream();
scoped_refptr<SegmentReader> CreateSegmentReader();
size_t ReadFromSegmentStream(SegmentStream&,
size_t amount_to_read = kInsideBufferPosition);
size_t PeekIntoSegmentStream(SegmentStream&,
size_t amount_to_peek = kInsideBufferPosition);
}
TEST(SegmentStreamTest, DefaultConstructorShouldSetIsCleared) { … }
TEST(SegmentStreamTest, DefaultConstructorShouldSetIsAtEnd) { … }
TEST(SegmentStreamTest, DefaultContructorShouldClearPosition) { … }
TEST(SegmentStreamTest, DefaultConstructorShouldHaveZeroLength) { … }
TEST(SegmentStreamTest, MoveConstructorShouldSetIsClearedWhenRhsIsCleared) { … }
TEST(SegmentStreamTest,
MoveConstructorShouldUnsetIsClearedWhenRhsIsNotCleared) { … }
TEST(SegmentStreamTest, MoveConstructorShouldSetIsAtEndWhenRhsIsAtEnd) { … }
TEST(SegmentStreamTest, MoveConstructorShouldUnsetIsAtEndWhenRhsIsNotAtEnd) { … }
TEST(SegmentStreamTest, MoveContructorShouldCopyRhsPosition) { … }
TEST(SegmentStreamTest, MoveConstructorShouldCopyRhsLength) { … }
TEST(SegmentStreamTest,
MoveAssignmentOperatorShouldSetIsClearedWhenRhsIsCleared) { … }
TEST(SegmentStreamTest,
MoveAssignmentOperatorShouldUnsetIsClearedWhenRhsIsNotCleared) { … }
TEST(SegmentStreamTest, MoveAssignmentOperatorShouldSetIsAtEndWhenRhsIsAtEnd) { … }
TEST(SegmentStreamTest,
MoveAssignmentOperatorShouldUnsetIsAtEndWhenRhsIsNotAtEnd) { … }
TEST(SegmentStreamTest, MoveAssignmentOperatorShouldCopyRhsPosition) { … }
TEST(SegmentStreamTest, MoveAssignmentOperatorShouldCopyRhsLength) { … }
TEST(SegmentStreamTest, SetReaderShouldUnsetIsCleared) { … }
TEST(SegmentStreamTest, SetReaderShouldUnsetIsAtEnd) { … }
TEST(SegmentStreamTest, SetReaderShouldNotChangePosition) { … }
TEST(SegmentStreamTest, SetReaderShouldUpdateLength) { … }
TEST(SegmentStreamTest, SetReaderShouldSetIsClearedWhenSetToNull) { … }
TEST(SegmentStreamTest, SetReaderShouldSetIsClearedWhenReaderSizeNotBigEnough) { … }
TEST(SegmentStreamTest, SetReaderShouldSetIsAtEndWhenReaderSizeNotBigEnough) { … }
TEST(SegmentStreamTest,
SetReaderShouldNotChangePositionWhenReaderSizeNotBigEnough) { … }
TEST(SegmentStreamTest, SetReaderShouldChangeLengthWhenReaderSizeNotBigEnough) { … }
TEST(SegmentStreamTest, SetReaderShouldSetIsAtEndWhenSetToNull) { … }
TEST(SegmentStreamTest, SetReaderShouldNotChangePositionWhenSetToNull) { … }
TEST(SegmentStreamTest, SetReaderShouldClearLengthWhenSetToNull) { … }
TEST(SegmentStreamTest, ReadShouldConsumeBuffer) { … }
TEST(SegmentStreamTest, ReadShouldNotClear) { … }
TEST(SegmentStreamTest, ReadShouldUpdateIsAtEnd) { … }
TEST(SegmentStreamTest, ReadShouldUpdatePosition) { … }
TEST(SegmentStreamTest, ReadShouldNotChangeLength) { … }
TEST(SegmentStreamTest, ReadShouldConsumeBufferWithoutGoingPastTheEnd) { … }
TEST(SegmentStreamTest, ReadShouldSetIsAtEndWhenPastEnd) { … }
TEST(SegmentStreamTest, ReadShouldTruncatePositionWhenPastEnd) { … }
TEST(SegmentStreamTest, PeekShouldConsumeBuffer) { … }
TEST(SegmentStreamTest, PeekShouldNotClear) { … }
TEST(SegmentStreamTest, PeekShouldNotUpdateIsAtEnd) { … }
TEST(SegmentStreamTest, PeekShouldNotUpdatePosition) { … }
TEST(SegmentStreamTest, PeekShouldNotChangeLength) { … }
TEST(SegmentStreamTest, PeekShouldConsumeBufferWithoutGoingPastTheEnd) { … }
TEST(SegmentStreamTest, PeekShouldNotSetIsAtEndWhenPastEnd) { … }
TEST(SegmentStreamTest, PeekShouldNotTruncatePositionWhenPastEnd) { … }
TEST(SegmentStreamTest, RewindShouldNotClear) { … }
TEST(SegmentStreamTest, RewindShouldNotSetAtEnd) { … }
TEST(SegmentStreamTest, RewindShouldResetPosition) { … }
TEST(SegmentStreamTest, RewindShouldNotChangeLength) { … }
TEST(SegmentStreamTest, HasPositionShouldBeSupported) { … }
TEST(SegmentStreamTest, SeekShouldNotSetIsCleared) { … }
TEST(SegmentStreamTest, SeekShouldNotSetIsAtEndWhenSeekingInsideTheBuffer) { … }
TEST(SegmentStreamTest, SeekShouldSetIsAtEndWhenSeekingToTheEndOfTheBuffer) { … }
TEST(SegmentStreamTest, SeekShouldUpdatePosition) { … }
TEST(SegmentStreamTest, SeekShouldNotTruncatePositionWhenPastEnd) { … }
TEST(SegmentStreamTest, SeekShouldNotUpdateLength) { … }
TEST(SegmentStreamTest, MoveShouldNotSetCleared) { … }
TEST(SegmentStreamTest, MoveShouldUpdatePosition) { … }
TEST(SegmentStreamTest, MoveShouldNotTruncatePositionWhenPastEnd) { … }
TEST(SegmentStreamTest, MoveShouldNotChangeLength) { … }
TEST(SegmentStreamTest, HasLengthShouldBeSupported) { … }
namespace {
::testing::AssertionResult IsCleared(const SegmentStream& segment_stream) { … }
::testing::AssertionResult IsAtEnd(const SegmentStream& segment_stream) { … }
::testing::AssertionResult PositionIsZero(const SegmentStream& segment_stream) { … }
::testing::AssertionResult PositionIsInsideBuffer(
const SegmentStream& segment_stream) { … }
::testing::AssertionResult PositionIsAtEndOfBuffer(
const SegmentStream& segment_stream) { … }
::testing::AssertionResult LengthIsZero(const SegmentStream& segment_stream) { … }
::testing::AssertionResult LengthIsAllocationSize(
const SegmentStream& segment_stream) { … }
SegmentStream CreatePopulatedSegmentStream() { … }
scoped_refptr<SegmentReader> CreateSegmentReader() { … }
size_t ReadFromSegmentStream(SegmentStream& segment_stream,
size_t amount_to_read) { … }
size_t PeekIntoSegmentStream(SegmentStream& segment_stream,
size_t amount_to_peek) { … }
}
}