chromium/services/tracing/public/cpp/perfetto/producer_test_utils.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "services/tracing/public/cpp/perfetto/producer_test_utils.h"

#include <deque>
#include <functional>
#include <optional>
#include <utility>

#include "base/debug/leak_annotations.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "services/tracing/public/cpp/tracing_features.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/perfetto/include/perfetto/ext/base/utils.h"
#include "third_party/perfetto/include/perfetto/ext/tracing/core/trace_writer.h"
#include "third_party/perfetto/include/perfetto/protozero/root_message.h"

namespace tracing {

namespace {

constexpr size_t kChunkSize =;

// For sequences/threads other than our own, we just want to ignore
// any events coming in.
class DummyTraceWriter : public perfetto::TraceWriter {};

}  // namespace

TestProducerClient::TestProducerClient(
    std::unique_ptr<base::tracing::PerfettoTaskRunner> main_thread_task_runner,
    bool log_only_main_thread)
    :{}

TestProducerClient::~TestProducerClient() = default;

std::unique_ptr<perfetto::TraceWriter> TestProducerClient::CreateTraceWriter(
    perfetto::BufferID target_buffer,
    perfetto::BufferExhaustedPolicy) {}

void TestProducerClient::FlushPacketIfPossible() {}

perfetto::protos::pbzero::TracePacket* TestProducerClient::NewTracePacket() {}

void TestProducerClient::FinishTracePacket() {}

size_t TestProducerClient::GetFinalizedPacketCount() {}

const perfetto::protos::TracePacket* TestProducerClient::GetFinalizedPacket(
    size_t packet_index) {}

const google::protobuf::RepeatedPtrField<perfetto::protos::ChromeMetadata>*
TestProducerClient::GetChromeMetadata(size_t packet_index) {}

const perfetto::protos::ChromeMetadataPacket*
TestProducerClient::GetProtoChromeMetadata(size_t packet_index) {}

// static
void TestProducerClient::WriteTraceToFile(
    const base::FilePath::StringType& filename,
    const PacketVector& packets) {}

// static
std::string TestProducerClient::SerializePacketsAsTrace(
    const PacketVector& finalized_packets) {}

TestTraceWriter::TestTraceWriter(TestProducerClient* producer_client)
    :{}

perfetto::TraceWriter::TracePacketHandle TestTraceWriter::NewTracePacket() {}

void TestTraceWriter::FinishTracePacket() {}

perfetto::WriterID TestTraceWriter::writer_id() const {}

uint64_t TestTraceWriter::written() const {}

DataSourceTester::DataSourceTester(
    tracing::PerfettoTracedProcess::DataSourceBase* data_source)
{}

DataSourceTester::~DataSourceTester() = default;

void DataSourceTester::BeginTrace(
    const base::trace_event::TraceConfig& trace_config) {}

void DataSourceTester::EndTracing() {}

size_t DataSourceTester::GetFinalizedPacketCount() {}

const perfetto::protos::TracePacket* DataSourceTester::GetFinalizedPacket(
    size_t packet_index) {}

void DataSourceTester::OnTraceData(
    base::RepeatingClosure quit_closure,
    const scoped_refptr<base::RefCountedString>& chunk,
    bool has_more_events) {}

}  // namespace tracing