blob: 06be8f7a5018b7f01b6bc38dc6f32525c9c65420 [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 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