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

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

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

#include <memory>
#include <string>

#include "base/memory/raw_ptr.h"
#include "base/trace_event/traced_value.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/perfetto/include/perfetto/protozero/scattered_heap_buffer.h"
#include "third_party/perfetto/include/perfetto/protozero/scattered_stream_writer.h"
#include "third_party/perfetto/protos/perfetto/trace/track_event/debug_annotation.pb.h"
#include "third_party/perfetto/protos/perfetto/trace/track_event/debug_annotation.pbzero.h"
#include "third_party/protobuf/src/google/protobuf/io/zero_copy_stream.h"

TracedValue;

namespace tracing {

namespace {

DebugAnnotation;
NestedValue;

class ProtoInputStream : public google::protobuf::io::ZeroCopyInputStream {};

class TracedValueProtoWriterTest : public testing::Test {};

const NestedValue* FindDictEntry(const NestedValue* dict, const char* name) {}

bool IsValue(const NestedValue* proto_value, bool value) {}

bool IsValue(const NestedValue* proto_value, double value) {}

bool IsValue(const NestedValue* proto_value, int value) {}

bool IsValue(const NestedValue* proto_value, const char* value) {}

NestedValue GetProtoFromTracedValue(TracedValue* traced_value) {}

TEST_F(TracedValueProtoWriterTest, FlatDictionary) {}

TEST_F(TracedValueProtoWriterTest, NoDotPathExpansion) {}

TEST_F(TracedValueProtoWriterTest, Hierarchy) {}

TEST_F(TracedValueProtoWriterTest, LongStrings) {}

// Test that the proto which results from the TracedValue is still
// valid regardless of the size of the buffer chunks we provide to
// the allocator, as some buffer sizes will leave unused bytes
// at the end where there isn't enough space for, say, a size field.
// 10-140 bytes tests both buffers being smaller and larger than
// the actual size of the proto.
TEST_F(TracedValueProtoWriterTest, ProtoMessageBoundaries) {}

TEST_F(TracedValueProtoWriterTest, PassTracedValue) {}

}  // namespace

}  // namespace tracing