chromium/components/webrtc_logging/common/partial_circular_buffer_unittest.cc

// Copyright 2013 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/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

// The test buffer data is 52 bytes, wrap position is set to 20 (this is
// arbitrarily chosen). The total buffer size is allocated dynamically based on
// the actual header size. This gives:
// Header of some size, non-wrapping part 20 bytes, wrapping part 32 bytes.
// As input data, a 14 byte array is used and repeatedly written. It's chosen
// not to be an integer factor smaller than the wrapping part. This ensures that
// the wrapped data isn't repeated at the same position.
// Note that desipte the number of wraps (if one or more), the reference output
// data is the same since the offset at each wrap is always the same.

#include "components/webrtc_logging/common/partial_circular_buffer.h"

#include <stddef.h>
#include <stdint.h>

#include <memory>

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

namespace webrtc_logging {

namespace {

const uint32_t kWrapPosition =;
const uint8_t kInputData[] =;
const uint8_t kOutputRefDataWrap[] =// The 20 bytes in the non-wrapping part.
    {};

}  // namespace

class PartialCircularBufferTest : public testing::Test {};

TEST_F(PartialCircularBufferTest, NoWrapBeginningPartOnly) {}

TEST_F(PartialCircularBufferTest, NoWrapBeginningAndEndParts) {}

TEST_F(PartialCircularBufferTest, WrapOnce) {}

TEST_F(PartialCircularBufferTest, WrapTwice) {}

TEST_F(PartialCircularBufferTest, WrapOnceSmallerOutputBuffer) {}

TEST_F(PartialCircularBufferTest, WrapOnceWithAppend) {}

TEST_F(PartialCircularBufferTest, WrapTwiceWithAppend) {}

TEST_F(PartialCircularBufferTest, WrapOnceThenOverwriteWithNoWrap) {}

TEST_F(PartialCircularBufferTest, WrapTwiceWithSingleWrite) {}

}  // namespace webrtc_logging