#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/spdy/spdy_read_queue.h"
#include <algorithm>
#include <cstddef>
#include <memory>
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "net/spdy/spdy_buffer.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net::test {
namespace {
const char kData[] = …;
const size_t kDataSize = …;
void EnqueueString(const std::string& data,
size_t max_buffer_size,
SpdyReadQueue* queue) { … }
std::string DrainToString(size_t max_buffer_size, SpdyReadQueue* queue) { … }
void RunEnqueueDequeueTest(size_t enqueue_max_buffer_size,
size_t dequeue_max_buffer_size) { … }
void OnBufferDiscarded(bool* discarded,
size_t* discarded_bytes,
size_t delta,
SpdyBuffer::ConsumeSource consume_source) { … }
}
class SpdyReadQueueTest : public ::testing::Test { … };
TEST_F(SpdyReadQueueTest, LargeEnqueueAndDequeueBuffers) { … }
TEST_F(SpdyReadQueueTest, OneByteEnqueueAndDequeueBuffers) { … }
TEST_F(SpdyReadQueueTest, CoprimeBufferSizes) { … }
TEST_F(SpdyReadQueueTest, Clear) { … }
}