chromium/base/metrics/sparse_histogram_unittest.cc

// Copyright 2012 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/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "base/metrics/sparse_histogram.h"

#include <memory>
#include <string>
#include <string_view>
#include <vector>

#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_base.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_samples.h"
#include "base/metrics/metrics_hashes.h"
#include "base/metrics/persistent_histogram_allocator.h"
#include "base/metrics/persistent_memory_allocator.h"
#include "base/metrics/sample_map.h"
#include "base/metrics/statistics_recorder.h"
#include "base/pickle.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "testing/gmock/include/gmock/gmock.h"

namespace base {

// Test parameter indicates if a persistent memory allocator should be used
// for histogram allocation. False will allocate histograms from the process
// heap.
class SparseHistogramTest : public testing::TestWithParam<bool> {};

// Run all HistogramTest cases with both heap and persistent memory.
INSTANTIATE_TEST_SUITE_P();

TEST_P(SparseHistogramTest, BasicTest) {}

TEST_P(SparseHistogramTest, BasicTestAddCount) {}

// Check that delta calculations work correctly with SnapshotUnloggedSamples()
// and MarkSamplesAsLogged().
TEST_P(SparseHistogramTest, UnloggedSamplesTest) {}

// Check that IsDefinitelyEmpty() works with the results of SnapshotDelta().
TEST_P(SparseHistogramTest, IsDefinitelyEmpty_SnapshotDelta) {}

TEST_P(SparseHistogramTest, AddCount_LargeValuesDontOverflow) {}

// Make sure that counts returned by Histogram::SnapshotDelta do not overflow
// even when a total count (returned by Histogram::SnapshotSample) does.
TEST_P(SparseHistogramTest, AddCount_LargeCountsDontOverflow) {}

TEST_P(SparseHistogramTest, MacroBasicTest) {}

TEST_P(SparseHistogramTest, MacroInLoopTest) {}

TEST_P(SparseHistogramTest, Serialize) {}

// Ensure that race conditions that cause multiple, identical sparse histograms
// to be created will safely resolve to a single one.
TEST_P(SparseHistogramTest, DuplicationSafety) {}

TEST_P(SparseHistogramTest, FactoryTime) {}

TEST_P(SparseHistogramTest, ExtremeValues) {}

TEST_P(SparseHistogramTest, HistogramNameHash) {}

TEST_P(SparseHistogramTest, CheckGetCountAndBucketData) {}

TEST_P(SparseHistogramTest, WriteAscii) {}

TEST_P(SparseHistogramTest, ToGraphDict) {}

}  // namespace base