blob: 734db63684bb4db7da60c7ee828b1379267269c5 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <utility>
#include "net/third_party/quiche/src/quic/platform/api/quic_mem_slice_span.h"
#include "net/quic/platform/impl/quic_test_mem_slice_vector_impl.h"
namespace quic {
namespace test {
// QuicTestMemSliceVector is a test only class which creates a vector of
// platform-specific data structure (used as QuicMemSlice) from an array of data
// buffers. QuicTestMemSliceVector does not own the underlying data buffer.
// Tests using QuicTestMemSliceVector need to make sure the actual data buffers
// outlive QuicTestMemSliceVector, and QuicTestMemSliceVector outlive the
// returned QuicMemSliceSpan.
class QUIC_NO_EXPORT QuicTestMemSliceVector {
explicit QuicTestMemSliceVector(std::vector<std::pair<char*, size_t>> buffers)
: impl_(std::move(buffers)) {}
QuicMemSliceSpan span() { return QuicMemSliceSpan(impl_.span()); }
QuicTestMemSliceVectorImpl impl_;
} // namespace test
} // namespace quic